Advertisement
ivana_andreevska

Gradle Test 1

May 18th, 2022
500
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. https://prnt.sc/ozVP2mZOaaL5
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class TriangleProblem {
  6.     public static void main(String[] args) {
  7.         printTriangleType();
  8.     }
  9.     static void printTriangleType()
  10.     {
  11.         Scanner scanner=new Scanner(System.in);
  12.         int a=scanner.nextInt();  //A
  13.         int b=scanner.nextInt();  //A
  14.         int c=scanner.nextInt();  //A
  15.         String type="scalene";    //B
  16.         if(a==b || b==c || a==c){ //C
  17.             type="isosceles";  //D
  18.         }
  19.         if(a==b && b==c) { //E
  20.             type="equal"; //F
  21.         }
  22.         if(a>=b+c || b>=a+c || c>=a+b) { //G
  23.             type="Not a triangle"; //H
  24.         }
  25.         if(a<=0 || b<=0 || c<=0) { //I
  26.             type="Bad input"; //J
  27.         }
  28.         System.out.println(type); //K
  29.     }
  30. }
  31.  
  32.  
Advertisement
RAW Paste Data Copied
Advertisement