Powered by Blogger.

Saturday, January 19, 2013

Area Of Traingle

#include<conio.h>
#include<iostream.h>
#include<math.h>
void main()
{
clrscr();
float a,b,c,s,area;
cout<<"enter the side of a, b &c:\n";
cin>>a>>b>>c;
cout<<"a="<<a<<"\n"<<"b="<<b<<"c="<<c<<endl;
if((a>=(b+c))||(b>=(a+c))||(c>=(a+b)))
cout<<"invalid data selected";
else
{
    s=(a+b+c)/2;
    area=sqrt(s*(s-a)*(s-b)*(s-c));
    cout<<"Area of Traingle is:"<<area;

}
getch();
}

0 comments:

Post a Comment