Home / Programs / Command Line Program to find Area of Traingle
Programming Example

Command Line Program to find Area of Traingle

👁 612 Views
💻 Practical Program
📘 Step by Step Learning
Command Line Program to find Area of Traingle

Program Code

#include <stdio.h>

int main(int argc, char *argv[])

{

             int base, height;

            float area;

             base = atol(argv[1]);

            height = atol(argv[2]);

            area = base*height/2;

            printf("%f",area);

}

Output

2  3 

3.000000

Explanation

Nope

How to learn from this program

First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.