index | submit | rank | book

digit-palindrome – Palindrome numbers

Write a program that reads several integers and prints whether they are palindrome or not. A number is palindrome if it is unchanged after being reversed. The number 616 is palindrome. The number 1234 is not palindrome.

Input and Output

Input will consist of several lines each with a number n where 0 ≤ n ≤ 1 000 000 000.

For each line of input, output should contain a single line with one of the following two messages:

either with <n> replaced by the number n.

Example Input

616
1234
789987

Example Output

616 is palindrome
1234 is not palindrome
789987 is palindrome

The palindrome function

Your program should be implemented using a palindrome function that receives one integer and returns a boolean value indicating whether it is palindrome. Please refer to the information for the chosen language:

Scoring

Submit your solution to be graded according to the following list:

Hints

If you have difficulty with this exercise, try digit-sum or digit-count first.

try first: digit-reverse oddeven

try next: bin2dec dec2bin

index | submit | rank | book

Copyright © 2020-2021 Rudy Matela
All rights reserved