#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double x1, x2, x3;
cout << "Input the lengths of three sides of a triangle: \n";
cout << "side 1: ";
cin >> x1;
cout << "side 2: ";
cin >> x2;
cout << "side 3: ";
cin >> x3;
bool isRight = false;
if (pow(x1, 2) == pow(x2, 2) + pow(x3, 2)) isRight = true;
if (pow(x2, 2) == pow(x1, 2) + pow(x3, 2)) isRight = true;
if (pow(x3, 2) == pow(x2, 2) + pow(x1, 2)) isRight = true;
if (isRight) cout << "The triangle is a right triangle.\n";
else cout << "The triangle isn't a right triangle.\n";
system("pause");
return 0;
}
Comments
Leave a comment