Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public class taskOne{
  2. public static void main(String args[]){
  3.  
  4. int sum = 0;
  5. double average = 0;
  6. int q = 0;
  7. int max = Integer.MIN_VALUE;
  8. int min = Integer.MAX_VALUE;
  9.  
  10.  
  11. while(!StdIn.isEmpty()){
  12. int n = StdIn.readInt();
  13.  
  14. if ( n > max){
  15. max = n;
  16. }
  17. if (n < min){
  18. min = n;
  19. }
  20.  
  21. sum = sum + n;
  22. q++;
  23.  
  24. }
  25. average = (double)sum/q;
  26. System.out.println("average: " + average);
  27. System.out.println("Max: " + max);
  28. System.out.println("Min: " + min);
  29.  
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement