Explore

Edit

Edit

# Check whether a number is PALINDROME or Not | FACE Prep

Published on 10 Mar 2020

Program to check whether the given number is a palindrome or not is discussed here. Any number is said to be a palindrome if the original number and the reverse of the original number are the same.

For example, 1234321 is a palindrome.

Original number = 1234321
The reverse of the number = 1234321


## Algorithm to check whether a number is a palindrome or not

• Input the number.
• Find the reverse of the number.
• If the reverse of the number is equal to the number, then return true. Else, return false.

A number can be checked if it is a palindrome or not in both iterative and recursive approaches. Both approaches are discussed below.

## Palindrome or not using iterative approach

C
C++
Java
Python 3

Output
Input- Enter an integer:1234321 Output- 1234321 is a palindrome

Time complexity: O(n)

## Palindrome or not using recursive approach

C
C++
Java
Python 3

Output
nput- Enter an integer:1234321 Output- 1234321 is a palindrome

Time complexity: O(n)

﻿Recommended Programs