Guest User

Untitled

a guest
Dec 15th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. int input = -1;
  2.  
  3. int total = 0, numInput = 0, max = 0, min = 0;
  4.  
  5. while ((input = keyboard.nextInt()) != 0) {
  6. numInput ++;
  7. total += input;
  8. if (max == 0 || input > max)
  9. max = input;
  10. if (min == 0 || input < min)
  11. min = input;
  12. }
  13.  
  14. System.out.println ("Max: " + max + " Min: " + min + " Average: " + (double) (total / numInput));
Add Comment
Please, Sign In to add comment