Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is judicial review?

Answered: 1 week ago