Question: Write a complete C++ program that: 1)Input: Reads a positive integer from the keyboard (user) with proper prompt text and save it to a variable.

Write a complete C++ program that:

1)Input: Reads a positive integer from the keyboard (user) with proper prompt text and save it to a variable. The integer have up to five digits.

2)Processing:

1. From the right most digit,extract every digit from the input integer using modular operator %then save the digit to a separate variable.

2. Remove the right most digit from the integer using integer division operator /.

3. Repeat above two steps till all digits have been extracted.

3) Output: Print out all digits of the integer in the right-to-left or the left-to-right order with proper prompts.

Note: Since the objective is practicing % and / operators, using other approaches will result in a deduction.

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!