import java.io.*; class Average7 { // A program that calculates the average of a series of integers. // A sentinel value is used to indicate the end of the series. // The program is intended to be used with input redirected from a // file, so it does not prompt for input. static final int SENTINEL = -999; public static void main(String[] args) throws IOException { BufferedReader in = Text.open(System.in); int sum=0,count=1,n; while(true) { n=Text.readInt(in); if(n==SENTINEL) break; sum+=n; count++; } System.out.println("Average is: "+Text.writeDouble((double)sum/(count-1),5,3)); } }