Write a program that reads a number from the user and does the following: Discard all but

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 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.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question
Question Posted: