C Program to find area of triangle given three sides of a triangle

User enters integer values for variable 'side1', 'side2' and 'side3', finds the area of a triangle by the given sides with formula as below: First calculate the value of 's' by the formula:

$$s = \frac{(side a + side b + side c)}{2}$$

Then area is calculated by the formula:

$$area = \sqrt{(s * (s - side1) * (s - side2) * (s - side3))}$$

The value stored at variable 'area' is printed on the console.

Program

#include<stdio.h>
#include<math.h>
void main()
{
	float side1, side2, side3, area, s;
	printf("Enter the three sides of triangle\n");
	printf("Side 1:\t");
	scanf("%f", &side1);
	printf("Side 2:\t");
	scanf("%f", &side2);
	printf("Side 3:\t");
	scanf("%f", &side3);
	s = (side1 + side2 + side3) / 2;
	area = sqrt(s * (s - side1) * (s - side2) * (s - side3));
	printf("Area of the triangle is: %f\n", area);
}

Output

Enter the three sides of triangle
Side 1:	20
Side 2:	13
Side 3:	24
Area of the triangle is: 129.988220