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:

`<n> is palindrome`

, if the number *n* is palindrome;
`<n> is not palindrome`

, if the number *n* is not palindrome;

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:

- Python definition:
`def palindrome(x):`

- C prototype:
`int palindrome(int x);`

- Haskell type:
`palindrome :: Int -> Bool`

- C++ prototype:
`bool palindrome(int x);`

- C# definition:
`public static bool DigitPalindrome(int x)`

in a public class `Program`

- Java definition:
`public static boolean digitPalindrome(int x)`

in a public class `DigitPalindrome`

- JavaScript definition:
`function digit_palindrome(x)`

- Lua definition:
`function digit_palindrome (x)`

- Ruby definition:
`def digit_palindrome(x)`

### Scoring

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

- 1/6: works for the above example but produces output in an incorrect format
- 2/6: works for the above example and produces output in the correct format
- 4/6: works for other test cases
- 5/6: works for edge cases
- 6/6: implements the
`palindrome`

function

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