fork(1) 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 min = Integer.MAX_VALUE; //As per given requirement 'min' can be set to any value >=100
  13. int max = Integer.MIN_VALUE; //As per given requirement 'max' can be set to any value <=0
  14.  
  15. try(Scanner input = new Scanner(System.in))
  16. {
  17. int inValue;
  18. for(int i=0; i<5; i++)
  19. {
  20. inValue = input.nextInt();
  21. if(inValue < min) min = inValue;
  22. if(inValue > max) max = inValue;
  23. }
  24. }
  25. System.out.println("Minimum value is : " + min);
  26. System.out.println("Maximum value is : " + max);
  27. }
  28. }
Success #stdin #stdout 0.06s 711680KB
stdin
3 90 7 1 34
stdout
Minimum value is : 1
Maximum value is : 90