Challenge: Find out if the Given Number is a Palindrome

Test your understanding by solving a difficult challenge in this lesson.

Problem statement

You are given a number. Your task is to find whether the given number is a palindrome or not.

πŸ“ A number is a palindrome if it reads the same backward as forward, e.g., 1221.

Input

We have already initialized the variable number at the backend.

Output

  • If the given number is a palindrome, then you should print is palindrome to the console.

  • If the given number is not a palindrome, then you should print not a palindrome to the console.

Sample input

int number = 212

Sample output

is palindrome

Coding exercise

Before diving directly into the solution, try to solve it yourself. Then, check if your code passes all the test cases.

πŸ“ Please use the variable number for the input and print your output to the console, or your code will not execute.

Good luck! πŸ‘

Get hands-on with 1200+ tech skills courses.