fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int a;
  13. int b;
  14. int c;
  15.  
  16. Scanner input = new Scanner (System.in);
  17.  
  18. //how to read three integers with white space delimiter
  19. System.out.print("Enter the 3 edges of the triangle to be calculated (separated by space): ");
  20. a = input.nextInt();
  21. b = input.nextInt();
  22. c = input.nextInt();
  23.  
  24. //then turn 3 integers into boolean form
  25. //this is only the algorithm
  26. Boolean isTriangle = ((a+b>c) && (b+c > a) && (c+a > b));
  27. System.out.print(isTriangle);
  28. }
  29. }
Success #stdin #stdout 0.11s 380672KB
stdin
5 6 7
stdout
Enter the 3 edges of the triangle to be calculated (separated by space): true