Advertisement
thenewboston

Java Programming Tutorial - 21 - Simple Averaging Program

Aug 22nd, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class apples{
  4.    public static void main(String args[]){
  5.       Scanner input = new Scanner(System.in);
  6.       int total = 0;
  7.       int grade;
  8.       int average;
  9.       int counter;
  10.  
  11.       while (counter < 10){
  12.          grade = input.nextInt();
  13.          total = total + grade;
  14.          counter++;
  15.       }
  16.       average = total/10
  17.       System.out.println("Your average is "+ average);
  18.    }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement