-
Notifications
You must be signed in to change notification settings - Fork 0
/
Beginner1045.c
51 lines (40 loc) · 1018 Bytes
/
Beginner1045.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
#include <stdio.h>
int main(){
double a, b, c, A, B, C;
scanf("%lf %lf %lf", &a, &b, &c);
// Arrange the triangle sides in decreasing order,
// so that the side A is the biggest of the three sides.
if (a >= b && a >= c){
A = a;
B = b;
C = c;
} else if (b >= a && b >= c) {
A = b;
B = a;
C = c;
} else if (c >= a && c >= b){
A = c;
B = a;
C = b;
}
if (A >= (B+C)){
printf("NAO FORMA TRIANGULO\n");
}
else if (A*A == (B*B + C*C)){
printf("TRIANGULO RETANGULO\n");
}
else if (A*A > (B*B + C*C)){
printf("TRIANGULO OBTUSANGULO\n");
}
else if (A*A < (B*B + C*C)){
printf("TRIANGULO ACUTANGULO\n");
}
// Independent conditions
if ((A == B) && (A == C)){
printf("TRIANGULO EQUILATERO\n");
}
if((A == B && A != C) || (A == C && A != B) || (B == C && A != C)){
printf("TRIANGULO ISOSCELES\n");
}
return 0;
}