to accept the lenght of three sides of a triangle and compute the area using two formulas
A 1\2*base*height
B herons formula for finding the area of a triangle
Answers
Answer:
Area of the triangle using herons formula and 1/2 base height
Explanation:
Let's see
1. Area of the triangle
For any programming language before starting the program you need to initialize the variables ( used to store values). int is for integer value.
int base, height.
After you assign the variable, the computer needs to ask the user to enter the variable. In C programming,
printf ("Enter the value for base");
printf ("Enter the value for height");
Then you need to add the operators ( +, ×, ÷, -) since it is a mathematical problem and assign it to a variable and store it. Float is for decimal value.
float triangle = 1/2 * (base) * (height);
Last, is to display the result to the user
printf(" The result is :%f", +triangle);
(%f is used for the float value, you can use %d for integer value)