Question: For this activity, I'd like you to write a C++ program that asks the user to input an integer to divide by, and an integer
For this activity, I'd like you to write a C++ program that asks the user to input an integer to divide by, and an integer that is an upper limit, and then computes and displays the sum of the remainders of the numbers from 1 to the limit. You may use a for, do, or while loop to accomplish this.
For example, if the user asks to divide by 7, with a limit of 200, then your program should add the remainders of 1 divided by 7, 2 divided by 7, 3 divided by 7, ...., 200 divided by 7, and then display the result. You can use the modulus operator % to find the remainder (for example, 17%7=3, since 17 divided by 7 is 2, with a remainder of 3).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
