## A22.0002 - ASSIGNMENT 6

Write a program that produces palindromic numbers: numbers that are the same forward as backward.

Use the following algorithm:

1. Start by taking a number.
2. If it isn't a palindrome:
• Reverse the number
• Add it to the original number
• Go back to step 2.
Example: the number 101 is a palindrome. The number 561, however, isn't. We take the reverse and add it to the previous: 165+561 = 726. This is still not a palindrome, so we repeat the step: 627+726=1,353. This is still not a solution and we repeat the procedure once more: 3,531+1,353=4,884. This is a palindrome, so we stop. It has taken us three steps to produce the palindrome.

The program should display the final palindrome and how many steps it took to produce it.

Specs : (i.e., what your procedure should and should not do)
You will have to implement the following helper functions:

• IsPalindrome: it will test a number and determine if it is a palindrome. It takes two parameters:
1. The number to be tested
2. A flag that is set to TRUE if it is a palindrome, else it is set to FALSE

• ReverseNumber: it will take a given number and return it's reverse. It takes two parameters:
1. The number to be reversed
2. The reverse number

Example runs:

```   Please enter number to start with: 123
Palindrome: 444
Number of reversals: 1