Advertisement
Tahamina_Taha

Calculate the Area of a Triangle(three sides,heron's formul)

Aug 17th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. #include<conio.h>
  4. //Calculate area of the triangle when three sides are given
  5. int main()
  6. {
  7.     int a,b,c;
  8.     double s,area;
  9.     printf("Enter three values: \n");
  10.     scanf("%d %d %d",&a,&b,&c);
  11.     s=(a+b+c)/2;
  12.     area = sqrt(s*(s-a)*(s-b)*(s-c));//its Heron's formula for the area of a triangle
  13.     printf("area of triangle : %.2lf",area);
  14.     getch();
  15.     return 0;
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement