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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started