Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q 2 Write a program and draw a flow chart to ask the user for repeated input by writing the input statements repeating multiple times.

Q2 Write a program and draw a flow chart to ask the user for repeated input by writing the input statements repeating multiple times. But it's more efficient to use loops to deal with repeated input.
Write a program that prompts the user for five numbers and computes the total of the numbers.
Example Output
Enter a number. 1
Enter a number: 2
Enter a number. 3
Enter a number: 4
Enter a number. 5
The total is 15.
Constraints
The prompting must use repetition, such as a counted loop, not three separate prompts.
Create a flowchart before writing the program.
Chalienges
Modify the program to prompt for how many numbers to add, instead of hard-coding the value. Be sure you convert the input to a number before doing the comparison.
Modify the program so that it only adds numbers and sitently rejects non-numeric values. Count these invalid entries as attempts anyway. In other words if the number of numbers to add is 5 : vous program should still prompt only five times
image text in transcribed

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Learn Mysql The Easy Way A Beginner Friendly Guide

Authors: Kiet Huynh

1st Edition

B0CNY7143T, 979-8869761545

More Books

Students also viewed these Databases questions

Question

5. Prepare for the role of interviewee

Answered: 1 week ago

Question

6. Secure job interviews and manage them with confidence

Answered: 1 week ago