Area of Triangle:
Area of triangle is equal to 0.5 times base multiplied by the height of triangle.
area = 0.5 * base * height
So what you have to do is to define three variables for base , height and area of type double as decimal value is involved in the formula and hence answer may come in decimal point. Rest the program is simple.
printf command is to display something and scanf command it take something from the user. Variable area first initialized to zero because there are chances of having garbage value.
Graphical Representation
Program Code:
Output:
Output
Download Program Code:
You can also Download program code from this.
No comments:
Post a Comment