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.

Revisions

  1. NenadSpasic created this gist Dec 5, 2016.
    23 changes: 23 additions & 0 deletions counter.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    /**
    * 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);
    }
    }