import java.util.Scanner; // from thenewboston Bucky tutorial on youtube // jamesprogram.java class jamesprogram { public static void main(String args[]){ Scanner myScanner = new Scanner(System.in); int total=0; int grade; int average; int counter=0; while (counter<10){ grade = myScanner1.nextInt(); total += grade; counter++; } average = total/10; System.out.println("Average= "+average); } }
This is the output if number 1 to 10 are entered:
1
2
3
4
5
6
7
8
9
10
Average= 5