Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class taskOne{
- public static void main(String args[]){
- int sum = 0;
- double average = 0;
- int q = 0;
- int max = Integer.MIN_VALUE;
- int min = Integer.MAX_VALUE;
- while(!StdIn.isEmpty()){
- int n = StdIn.readInt();
- if ( n > max){
- max = n;
- }
- if (n < min){
- min = n;
- }
- sum = sum + n;
- q++;
- }
- average = (double)sum/q;
- System.out.println("average: " + average);
- System.out.println("Max: " + max);
- System.out.println("Min: " + min);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement