SHARE
TWEET

Untitled

a guest Sep 25th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.    
  3.     public class averageloop{
  4.  
  5.         public static void main(String[] args){
  6.  
  7.            
  8.             Scanner input = new Scanner(System.in);
  9.  
  10.             System.out.print("How many exams have you taken");
  11.  
  12.             int exam = input.nextInt();
  13.  
  14.             double i;
  15.  
  16.             //Loop through however many times is inputed
  17.             for(i = 0; i< exam; i++){
  18.  
  19.             System.out.println("Enter Your Scores: ");
  20.  
  21.             points = input.next();
  22.  
  23.             double totalpoints = totalpoints + points;
  24.  
  25.             }
  26.  
  27.             double avg;
  28.  
  29.             avg = (totalpoints / i);
  30.  
  31.             System.out.println("Your average is " + avg);
  32.  
  33. }
  34.  
  35.     }
RAW Paste Data
Top