76 387
Assignments Done
98,1%
Successfully Done
In May 2019

# Answer to Question #48788 in C++ for ama nae

Question #48788
Given the lengths a,b,c of the sides of triangle, write a function based program to compute the area of the triangle., The formula for computing the area is given by:

Area = √ s(s-a)(s-b)(s-c)
where s is the semiparameter of the triangle
s=(a+b+c)/2
Expert's answer
//Header files
#include <iostream>
#include <math.h>

using namespace std;

// Create a main function
int main()
{
//Declaring Variables
double Area=0;
double a=0,b=0,c=0,s=0;

cout<<"Enter the lengthof side (a): ";
cin>>a;

cout<<"Enter thelength of side (b): ";
cin>>b;

cout<<"Enter thelength of side (c): ";
cin>>c;

//The formula for computing
s=(a+b+c)/2;
Area=sqrt(s*(s-a)*(s-b)*(s-c));

//Result
cout<<endl<<endl<<"The area ofthe triangle: "<<Area<<endl;

cin.get();
return 0;
}
``﻿``

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

#### Comments

No comments. Be first!

Submit