Explore
ProGrad Programs
About Us

Edit
Reply




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

palindrome of a a number

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










If you have any feedback about this article and want to improve this, please write to enquiry@faceprep.in