Question
Write a simple program based on the use of For and NN bile Loops to calculate the average of numbers. The program should ask the
Write a simple program based on the use of For and NN bile Loops to calculate the average of numbers. The program should ask the user to enter how many numbers they want to find the average for and to calculate the average depending on that.
Write the program Nice: once using for loop and once using while loop. If thc user will enter zero or a negative number, the program should display a message (Not valid number)
For example if the user wants to find the average of 3 numbers, the output should be: lion many numbers do you want to find the average for?
3
Enter the numbers
2
3
1
the average is 2
Step by Step Solution
3.26 Rating (152 Votes )
There are 3 Steps involved in it
Step: 1
Using for loop includ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Business Forecasting With Forecast X
Authors: Holton Wilson, Barry Keating, John Solutions Inc
6th Edition
73373648, 978-9339220426, 9339220420, 978-0073373645
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App