Question: Write a program that reads a number from the user and does the following: Discard all but the last three digits. Reverse the digits, subtract
Write a program that reads a number from the user and does the following: Discard all but the last three digits. Reverse the digits, subtract the original from the reversed (discarding any minus sign), reverse the digits of the difference, and add the difference and the reversed difference. Then print the sum. For example:
Input: 371 Reversed: 173 Difference: 198 Reversed: 891 Sum: 1089 This procedure is sometimes called the “1089 puzzle” because the final result is 1089 in most cases.
Step by Step Solution
3.34 Rating (166 Votes )
There are 3 Steps involved in it
Sure I can help with that Heres a simple Python program that performs the above operations python de... View full answer
Get step-by-step solutions from verified subject matter experts
