Programming In C
Improve your Programming Skills with almost every C Program.
Home
Blog Posts
Life Style
Relationship
Make Money
Follow Us
Facebook
Twitter
About Us
Who We Are?
Contact Us
Monday, September 12, 2011
Area of triangle program
Q. Write a function to find the area of a triangle whose length of three sides is given.
Ans.
/*Program to area of triangle using Heron's Formula*/
#include
<
stdio.h
>
#include
<
conio.h
>
#include
<
math.h
>
int
main()
{
int
x=10,y=8,z=7;
float
s=0.0;
double
area=0;
s=(x+y+z)/2.0;
area=(s*(s-x)*(s-y)*(s-z));
printf(
"\nArea of triangle = %lf"
,area);
getch();
return
0
;
}
/**************OUTPUT***************
Area of triangle =
773.43750075
************************************/
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment