Java Programming Tutorial – 6 – Getting User Input

By | 2015년 3월 31일

package hello;
import java.util.Scanner; 

public class apples {
    public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		 int total = 0;
		 int grade;
		 int average;
		 int counter = 0;
		 
		 while(counter < 10){
			 grade = input.nextInt();
			 total = total + grade;
			 counter++;
		 }
		 average = total/10;
		 System.out.println("Your averager is " + average );
	}
}