-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathP5717.cpp
53 lines (48 loc) · 878 Bytes
/
P5717.cpp
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
using namespace std;
int main()
{
int a, b, c, tmp;
cin >> a >> b >> c;
//ensure the a is the maximum
if(b>=a && b>=c)
{
tmp = a;
a = b;
b = tmp;
}
else if(c>=a && c>=b)
{
tmp = a;
a = c;
c = tmp;
}
if (b+c > a)
{
if (b*b+c*c == a*a)
{
cout << "Right triangle" << endl;
}
if (b*b+c*c > a*a)
{
cout << "Acute triangle" << endl;
}
if (b*b+c*c < a*a)
{
cout << "Obtuse triangle" << endl;
}
if (b==c)
{
cout << "Isosceles triangle" << endl;
}
if (a==b && b == c)
{
cout << "Equilateral triangle" << endl;
}
}
else
{
cout << "Not triangle";
}
return 0;
}