Answer to Question #279459 in C++ for Kyut

Question #279459

2. The area of a triangle whose sides a, b, and c can be computed by the formula:


𝑨𝒓𝒆𝒂 𝒐𝒇 π‘»π’“π’Šπ’‚π’π’ˆπ’π’† = βˆšπ‘ ((𝑠 βˆ’ π‘Ž)(𝑠 βˆ’ 𝑏)(𝑠 βˆ’ 𝑐))

1
Expert's answer
2021-12-14T07:02:53-0500
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	cout<<"Enter the first side: \n";
	double a;
	cin>>a;
		cout<<"Enter the second side: \n";
	double b;
	cin>>b;
Β  cout<<"Enter the third side: \n";
	double c;
	cin>>c;
	double s = (a + b + c) / 2;
	
	double area = sqrt(s*(s-a) * (s-b) * (s-c));
	cout<<"The area of the triangle is: "<<area<<endl;
}

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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog