Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class averageloop{
- public static void main(String[] args){
- Scanner input = new Scanner(System.in);
- System.out.print("How many exams have you taken");
- int exam = input.nextInt();
- double i;
- //Loop through however many times is inputed
- for(i = 0; i< exam; i++){
- System.out.println("Enter Your Scores: ");
- points = input.next();
- double totalpoints = totalpoints + points;
- }
- double avg;
- avg = (totalpoints / i);
- System.out.println("Your average is " + avg);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement