-
Notifications
You must be signed in to change notification settings - Fork 0
/
P5717-trangle-saperater.c
57 lines (46 loc) · 1.02 KB
/
P5717-trangle-saperater.c
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
54
55
56
57
#include<stdio.h>
int getmax(int a, int b, int c) {
if (a >= b && a >= c) {
return a;
}
if (b >= a && b >= c) {
return b;
}
return c;
}
int getmin(int a, int b, int c) {
if (a <= b && a <= c) {
return a;
}
if (b <= a && b <= c) {
return b;
}
return c;
}
int main() {
int a, b, c, max, min, mid;
scanf("%d%d%d", &a, &b, &c);
max = getmax(a, b, c);
min = getmin(a, b, c);
mid = a + b + c - max - min;
if ((a+b+c) <= (2 * max)) {
printf("Not triangle\n");
return 0;
}
if (min * min + mid * mid == max * max) {
printf("Right triangle\n");
}
if (min * min + mid * mid > max * max) {
printf("Acute triangle\n");
}
if (min * min + mid * mid < max * max) {
printf("Obtuse triangle\n");
}
if (min == mid || max == mid) {
printf("Isosceles triangle\n");
}
if (max == min && min == mid) {
printf("Equilateral triangle\n");
}
return 0;
}