Improved code!

0 felipe lopez · September 19, 2016

Scanner input = new Scanner(System.in);
int total = 0;
int grade;
int average;
int counter = 0;
int maxCounter = 10;

while(counter < maxCounter){
grade = input.nextInt();
total = total + grade;
counter++;
}

average = total / counter;
System.out.println("Your average is: " + average);



Post a Reply

Replies

Oldest  Newest  Rating
0 Michael Troggers · April 23, 2017
Nice
  • 1

Java / Android Development

131,103 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator