Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // CW
- import java.util.Scanner;
- public class Triangle {
- public static void main(String[] args)
- {
- Scanner in = new Scanner (System.in);
- int a, b, c;
- System.out.println("Enter the three sides of your triangle:");
- a = Math.abs(in.nextInt());
- b = Math.abs(in.nextInt());
- c = Math.abs(in.nextInt());
- if ((a == b) || (b == c) || (a == c))
- System.out.println("Isosceles triangle");
- else if (Math.pow((double)a, 2) + Math.pow((double)b, 2) == Math.pow((double)c, 2) || Math.pow((double)c, 2) + Math.pow((double)b, 2) == Math.pow((double)a, 2) || Math.pow((double)a, 2) + Math.pow((double)c, 2) == Math.pow((double)b, 2))
- System.out.println("Right triangle");
- else
- System.out.println("Just a regular triangle!");
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment