CProgram

# Find Area of a Triangle using Hero’s Formula

Write a C program to find the area of a Triangle using Hero’s Formula.

/** Program to Find Area of a Triangle using Hero’s Formula **/
#include <stdio.h>
#include <math.h>
main()
{
float a, b, c, s, area;
back:
printf(“\nEnter three sides of a triangle: “);
scanf(“%f %f %f”, &a, &b, &c);
if (a==0 || b==0 || c==0)
{
printf(“\nValue of any side should not be equal to
zero\n”);
goto back;
}
if (a+b<c || b+c<a || c+a<b)
{
printf(“\nSum of two sides should not be less than
third\n”);
goto back;
}
s = (a + b + c) / 2;
area = sqrt(s * (s – a) * (s – b) * (s – c));
printf(“\n\nArea of triangle: %.2f”, area);
getch();
}

Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0

C

C

C

### Reverse the order of each word of the string using pointers

Write a C program to reverse the order of each word of the string using ...

### Convert temperature from degree centigrade to Fahrenheit

Write a C program to convert temperature from degrees Centigrade to Fahrenheit. #include<stdio.h> int main() { float celsius, fahrenheit; ...

### Program to find Average of three Real Numbers

Write a C program to an average of three real numbers. #include <stdio.h> main() { ...

### Find Area of Square & Circumference of a Circle

Write a C program to find the area of a square & circumference of a ...