Question: Write a program that continues to ask a user to input numbers until their sum equals 1 0 0 . The input statement should keep

Write a program that continues to ask a user to input numbers until their sum equals 100.
The input statement should keep track of the try # (#1, #2,..., etc.)
The program also suggests a number to the user that could end the program.
When the sum equals 100 the program exits and congratulates the user.
After 5 unsuccessful tries the program exits and tells the user that they have failed.
Your output should look like so:
The program will end as soon as the sum of input numbers reaches 100
Input the following number to end the program: 100
Please input #1: 45
Input the following number to end the program: 55
Please input #2: 55
Congratulations you have succeeded

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!