Saturday, July 16, 2011

Write a c program to find the area of a triangle




C
program for area of a triangle







Formula of
area of any triangle:



Area = v(s*(s-a)*(s-b)*(s-c))

Where s = (a + b + c)/2



C code:



#include

#include



int main(){



float a,b,c;

float s,area;



printf("Enter
size of each sides of triangle");

scanf("%f%f%f",&a,&b,&c);



s
= (a+b+c)/2;

area
= sqrt(s*(s-a)*(s-b)*(s-c));

No comments:

Post a Comment