Martes, Pebrero 7, 2012

basic 18: average the num

package basic;
import java.util.Scanner;
public class Basic {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        
       int grade=0;
       int total=0;
       int ave;
       int ctr=0;
       
       
       while (ctr < 10){
           
           ctr++ ;
           System.out.println("input number");
        grade = input.nextInt();
       total = grade + total;


         }
   ave = total/10;
   
        System.out.println("here's the average :" +ave);
    }
}

Walang komento:

Mag-post ng isang Komento