fork download
  1. import java.util.Scanner;
  2.  
  3. public class MinMaxFinder
  4. {
  5. public static void main(String [] args)
  6. {
  7. int min = Integer.MAX_VALUE;
  8. int max = Integer.MIN_VALUE;
  9.  
  10. Scanner console = new Scanner(System.in);
  11.  
  12. for(int i = 0; i < 5; i++)
  13. {
  14. System.out.println("Enter a number!");
  15. int temp = console.nextInt();
  16. smallest(temp , min);
  17. largest(temp , max);
  18.  
  19. }
  20. }
  21.  
  22. public static int smallest(int a, int b)
  23. {
  24. return Math.min(a, b);
  25. }
  26.  
  27. public static int largest(int a, int b)
  28. {
  29. return Math.max(a, b);
  30. }
  31.  
  32.  
  33. }
  34.  
Runtime error #stdin #stdout 0.26s 213120KB
stdin
Standard input is empty
stdout
Standard output is empty