Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Lesson_17_Activity_One {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- System.out.println("Please list a list of test scores.");
- int x; //input
- int y = 0; //total
- int z = 0; //numbers
- while ((x = scanner.nextInt()) != -1) {
- y += x;
- ++z;
- }
- System.out.println("The average is: " + (double) y / z);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement