import java.util.Scanner; public class CalculateAverageProgram { public static void main(String[] args) { int nums, sum; System.out.println("How many exam marks do you want to average ?"); nums = new Scanner(System.in).nextInt(); sum = 0; // Get the numbers one at a time, and add them for (int count=1; count<=nums; count++) { System.out.print("Enter exam mark " + count + ": "); sum += new Scanner(System.in).nextInt(); } System.out.println("The average is " + (sum / nums)); } }