Area of Triangle using Hero's Formula in C

#include <stdio.h>
#include <conio.h>
main()
{

float a, b, c, s, area;
back:
printf(" Enter three sides of a triangle: ");
scanf("%f %f %f", &a, &b, &c);

 

if (a==0 || b==0 || c==0)
{
printf(" Value of any side should not be equal to zero ");
goto back;
}

 

if (a+b<c || b+c<a || c+a<b)

{
printf(" Sum of two sides should not be less than third ");
goto back;
}

 

s = (a + b + c) / 2;
area = sqrt(s * (s - a) * (s - b) * (s - c));
printf(" Area of triangle: %.2f", area);

 

getch();

}

Upload Content

Upload your original content. We will publish your material under your name on W3Professors after review.

Feedback

Without your feedback, such words as Improvement, Achievement and Success have no meaning for us.


W3Professors is only to provide online education. We do not warrant oraginality of any content. Whole content is uploaded by someone so if you feel that particular content is copied or not upto mark. You can click on Copied Content link. We will remove that content Immediately. You agree to have read and accept our Terms of Use and Privacy Policy. © Copyright 2008-2015 W3Professors.Com All Rights Reserved.

Designed and Maintained by Kanwer Technologies