A triangle is said to be an equable triangle, if the area of the triangle is equal to the perimeter. Write a program to enter three sides of a triangle. Check and print whether the triangle is equable or not.
Answers
Answered by
2
Answer:
#include<math.h>
#include <iostream>
using namespace std;
int main() {
double s1,s2,s3;
cout<<"Enter first side ";
cin>>s1;
cout<<"Enter second side ";
cin>>s2;
cout<<"Enter third side ";
cin>>s3;
double s=(s1+s2+s3)/2;
double ar=s*(s-s1)*(s-s2)*(s-s3);
double area=pow(ar,0.5);
double per=s1+s2+s3;
if(area==per)
cout<<"It's an equable triangle";
else
cout<<"It's not an equable triangle";
return 0;
}
Explanation:
I have written it in c++
You can implement it any language as you didn't mention the language
find the area and perimeter and equate the values
ex:- sides 6,8,10
It's an equable triangle
Hope it helps :-)
Similar questions