1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#include <iostream>
#include <math.h>
#include <conio.h>
using namespace std;
double s_triangle (double a, double b, double c);
double a_triangle (double s, double a, double b, double c);
int main()
{
double a,b,c,s,area;
cout<<"Enter Length of First side: ";
cin>>a;
cout<<"Enter Length of Second side: ";
cin>>b;
cout<<"Enter Length of Third side: ";
cin>>c;
s=s_triangle (a,b,c);
area=a_triangle (s,a,b,c);
cout<<"The Area of the Triangle is "<<area<<".\n";
return 0;
}
double s_triangle (double a, double b, double c){
return ((a+b+c)/2);
}
double a_triangle (double s,double a,double b,double c){
return (sqrt(s(s-a)(s-b)(s-c)));
}
|