Advertisement
JamesUlip

add all then everage

Jul 11th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1.     import java.util.Scanner;
  2.     class asd {
  3.      
  4.     public static void main(String[]args)
  5.     {
  6.     int input,s,w,sum=0,a=0,x=1;
  7.     Scanner in = new Scanner(System.in);
  8.     System.out.println("How many Numbers You want to Intput: ");
  9.     input=in.nextInt();
  10.     do{
  11.     System.out.print(x +" ");
  12.     System.out.println("Number: ");
  13.     a=in.nextInt();
  14.     sum=sum+a;
  15.     x++;
  16.     }
  17.     while(x<=input);
  18.     s=sum/input;
  19.     System.out.println("The Average is: " +s);
  20.     }
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement