Skip to content

Instantly share code, notes, and snippets.

@NenadSpasic
Created December 5, 2016 22:32
Show Gist options
  • Select an option

  • Save NenadSpasic/a8a950c35f9905bc1088e3f4ba68c48e to your computer and use it in GitHub Desktop.

Select an option

Save NenadSpasic/a8a950c35f9905bc1088e3f4ba68c48e to your computer and use it in GitHub Desktop.
/**
* Created by Nenad Spasic on 12/5/2016.
*/
import java.util.Scanner;//import java.util.Scanner;
public class Counter {
public static void main ( String[]args ) {
Scanner input = new Scanner(System.in);
int counter = 0;
int total = 0;
int average;
int grade;
while (counter <= 5) {
grade = input.nextInt();
total = total + grade;
counter++;
}
average = total/5;
System.out.println("your average is " + average);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment