Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://prnt.sc/ozVP2mZOaaL5
- import java.util.Scanner;
- public class TriangleProblem {
- public static void main(String[] args) {
- printTriangleType();
- }
- static void printTriangleType()
- {
- Scanner scanner=new Scanner(System.in);
- int a=scanner.nextInt(); //A
- int b=scanner.nextInt(); //A
- int c=scanner.nextInt(); //A
- String type="scalene"; //B
- if(a==b || b==c || a==c){ //C
- type="isosceles"; //D
- }
- if(a==b && b==c) { //E
- type="equal"; //F
- }
- if(a>=b+c || b>=a+c || c>=a+b) { //G
- type="Not a triangle"; //H
- }
- if(a<=0 || b<=0 || c<=0) { //I
- type="Bad input"; //J
- }
- System.out.println(type); //K
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement