import java.util.Scanner; public class Average { public static void main(String[] args) { Scanner input = new Scanner(System.in); double total = 0; int count = 0; System.out.println("Enter a sequence of integers"); while ( input.hasNextInt() ) { total += input.nextInt(); count++; } System.out.println("Average: " + (total/count)); } }