Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int input = -1;
- int total = 0, numInput = 0, max = 0, min = 0;
- while ((input = keyboard.nextInt()) != 0) {
- numInput ++;
- total += input;
- if (max == 0 || input > max)
- max = input;
- if (min == 0 || input < min)
- min = input;
- }
- System.out.println ("Max: " + max + " Min: " + min + " Average: " + (double) (total / numInput));
Add Comment
Please, Sign In to add comment