Created
October 18, 2015 15:18
-
-
Save StrixG/93147f2c92aca493bbf5 to your computer and use it in GitHub Desktop.
Тип треугольника
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
int[] sides = {in.nextInt(), in.nextInt(), in.nextInt()}; | |
Arrays.sort(sides); | |
if (sides[0] < sides[1] + sides[2] && sides[1] < sides[0] + sides[2] && sides[2] < sides[0] + sides[1]) { | |
double legSum = Math.pow(sides[0], 2) + Math.pow(sides[1], 2); | |
double hypotenuse = Math.pow(sides[2], 2); | |
if (legSum == hypotenuse) { | |
System.out.println("right"); | |
} else if (legSum > hypotenuse) { | |
System.out.println("acute"); | |
} else if (legSum < hypotenuse) { | |
System.out.println("obtuse"); | |
} | |
} else { | |
System.out.println("impossible"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment