Skip to content

Instantly share code, notes, and snippets.

@folivetti
Created February 17, 2017 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save folivetti/bc1caa81f06812fbb6171605f8e99984 to your computer and use it in GitHub Desktop.
Save folivetti/bc1caa81f06812fbb6171605f8e99984 to your computer and use it in GitHub Desktop.
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
double A, B, C, temp;
Scanner sc = new Scanner(System.in);
A = sc.nextDouble();
B = sc.nextDouble();
C = sc.nextDouble();
if (A < B) {
temp = A;
A = B;
B = temp;
}
if (A < C) {
temp = A;
A = C;
C = temp;
}
if (B < C) {
temp = B;
B = C;
C = temp;
}
if ( A >= (B+C) ) {
System.out.println("NAO FORMA TRIANGULO");
} else {
if ( A*A == (B*B + C*C) ) {
System.out.println("TRIANGULO RETANGULO");
} else if ( A*A > (B*B + C*C) ) {
System.out.println("TRIANGULO OBTUSANGULO");
} else {
System.out.println("TRIANGULO ACUTANGULO");
}
if (A==B && B==C) {
System.out.println("TRIANGULO EQUILATERO");
} else if (A==B || B==C || A==C) {
System.out.println("TRIANGULO ISOSCELES");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment