Question: Given an integer variable n (which has a value, of course), write C++ statements to repeatedly ask the user to enter a real number n

Given an integer variable n (which has a value, of course), write C++ statements to repeatedly ask the user to enter a real number n times and keep a running sum of all the numbers entered that are less than 100. If at any time the user enters a negative number, ignore that number and quit right there. Then print the sum. A few test runs of the working program, with n set to 3, should look like (user input in gray):

Example #1: Enter a real number: 2.5 Enter a real number: -4 Sum is: 2.5 
Example #2: Enter a real number: 2.5 Enter a real number: 3 Enter a real number: 2.23 Sum is: 7.73 
Example #3: Enter a real number: 107 Enter a real number: 2030 Enter a real number: 2.3 Sum is: 2.3 

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 Databases Questions!