-
Notifications
You must be signed in to change notification settings - Fork 0
/
URI_1045.java
56 lines (42 loc) · 1.09 KB
/
URI_1045.java
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
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
double []a = new double[3];
for (int i = 0; i < a.length; i++) {
a[i] = scanner.nextDouble();
}
double temp;
for (int i = 0; i < a.length; i++) {
for (int j = i+1; j < a.length; j++) {
if ( a[j] > a[i] ) {
temp = a[j];
a[j] = a[i];
a[i] = temp;
}
}
}
double A = a[0];
double B = a[1];
double C = a[2];
if ( A >= B + C ) {
System.out.printf("NAO FORMA TRIANGULO\n");
}
else if ( A*A > B*B + C*C ) {
System.out.printf("TRIANGULO OBTUSANGULO\n");
}
if ( A*A == B*B + C*C ) {
System.out.printf("TRIANGULO RETANGULO\n");
}
if ( A*A < B*B + C*C ) {
System.out.printf("TRIANGULO ACUTANGULO\n");
}
if ( A == B && B == C && A == C ) {
System.out.printf("TRIANGULO EQUILATERO\n");
}
if ( ((A == B) && (A!=C)) || (( A==C)&&(A!=B)) || ((B==C)&&(B!=A)) ) {
System.out.printf("TRIANGULO ISOSCELES\n");
}
}
}