Header Ads Widget

write a program to calculate the area of the triangle using formula at= root s(s-a)(s-b)(s-c)



 Code:-

#include<stdio.h>
#include<math.h>
int main()
{
float s,a,b,c,area;
printf("Enter sides of the triangle\n");
scanf("%f%f%f",&a,&b,&c);
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf("Area of the triangle is: %f",area);
return 0;
}

Output:-


Enter the sides of the triangle
2 3 4
Area of the triangle is : 2.904737



Recommended Post:-


         MCQs:-


Post a Comment

0 Comments