Question: Write a java program that reads in numbers from the console using Scanner. Print the sum of all the inputs till that point. Also, print
Write a java program that reads in numbers from the console using Scanner. Print the sum of all the inputs till that point. Also, print how many numbers have been entered. When the user enters -1, give the average of the numbers. Use a while loop. Print an output to similar to the given sample run.
Sample Run: Input: 20 Sum: 20, Numbers entered: 1
nput: 3 Sum: 23, Numbers entered: 2
Input: 1, Sum: 24, Numbers entered: 3
Input: -1 Program Stopped ! Average is 8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
