Filled Under:

Area of Triangle using Heron's Formula in C

Area of Triangle using Heron's Formula in C

Area of Triangle using Heron's Formula in C

 In this program, I have discussed about the Area of Triangle using Heron's Formula in C.

Heron's formula states that if a, b,c are the three sides of a triangle then the area of that triangle will be equal to [ area=sqrt(s*(s-a)*(s-b)*(s-c))] , where s=(a+b+c)/2.

--------------------------------------------------------------------------------


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




---------------------------------------------------------------------
Just copy and paste the program in your desired compiler (Dev C++ is more preferable) and run it.

Enjoy programming in C.



0 comments:

Post a Comment

 

Copyright 2020 Programming in C All Right Reserved