===========================================================================
CODING
#include<iostream.h>
#include<conio.h>
#include<math.h>
float Area(float,float,float);
void main()
{
clrscr();
float a,b,c;
cout<<" Area of a Triangle";
cout<<"\n ------------------";
cout<<"\n\n ¯Enter 1st Side: ";
cin>>a;
cout<<"\n\n ¯Enter 2nd Side: ";
cin>>b;
cout<<"\n\n ¯Enter 3rd Side: ";
cin>>c;
cout<<"\n\n => Area: "<<Area(a,b,c)<<" sq units";
getch();
}
float Area(float a,float b,float c)
{
float s,Ar;
s=(a+b+c)/2;
Ar=sqrt(s*(s-a)*(s-b)*(s-c));
return Ar;
}
CODING
#include<iostream.h>
#include<conio.h>
#include<math.h>
float Area(float,float,float);
void main()
{
clrscr();
float a,b,c;
cout<<" Area of a Triangle";
cout<<"\n ------------------";
cout<<"\n\n ¯Enter 1st Side: ";
cin>>a;
cout<<"\n\n ¯Enter 2nd Side: ";
cin>>b;
cout<<"\n\n ¯Enter 3rd Side: ";
cin>>c;
cout<<"\n\n => Area: "<<Area(a,b,c)<<" sq units";
getch();
}
float Area(float a,float b,float c)
{
float s,Ar;
s=(a+b+c)/2;
Ar=sqrt(s*(s-a)*(s-b)*(s-c));
return Ar;
}
===========================================================================
No comments:
Post a Comment