import java.io.*; class Average3 { // A program that calculates the average of a series of integers. // It prompts for each one then asks if there are any more. public static void main(String[] args) throws IOException { BufferedReader in = Text.open(System.in); int sum=0,count=0; char ch; do { count++; System.out.print("Enter number "+count+": "); sum+=Text.readInt(in); do { System.out.print("Do you want any more numbers? (y/n): "); ch=Text.readChar(in); } while(ch!='y'&&ch!='n'); } while(ch=='y'); System.out.println("Average is: "+Text.writeDouble((double)sum/count,5,3)); } }