Check the given number is palindrome or not

Check the given number is palindrome or not

A palindromic number (also known as a digit palindrome or numeric palindrome) is a number that remains the same when its digits are reversed. For example, 16461, it is “symmetric”. The term palindromic is derived from the palindrome, which refers to a word (such as a rotor or racecar) whose spelling is unchanged when its letters are reversed. The first 30 palindromic numbers (in decimal) are:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 202, etc. …..

Sentence-length palindromes can be written when allowances are made for the adjustment of capital letters, punctuation marks, and word dividers, such as “one man, one plan, one canal, Panama!”

Program:

Q)  Applying Python script to check the given number is palindrome or not.

Purpose:  To check the given number is synergy or not.

Find prime number in python
Algorithm:

Step 1: Start
Step2: Declare the variable n and read n.
Step3: Assign k to n
Step 4: Initialize r to 0
Step 5: in the while loop
Display
d = n% 10
R = r * 10 + d
N = math.floor (n / 10)
Step 6: Check the status r == k.
Step 7: If the condition is correct that the given number is palindrome
Step 8: Otherwise print that the given number is not Palindrome
Step 9: End

Source Code:

Import math
n = int (input (“Enter number:”))
k = n
R = 0
While n> 0:
d = n% 10
R = r * 10 + d
N = math.floor (n / 10)
If r == k:
Print (“The given number is the palindrome”)
And: print (“The given number is not a palindrome”)

Output:

>>> Enter number: 1221
Number given is palindrome
>>>
>>>
Enter number: 52
The number given is not a palindrome

Related Link:

for more detail you can go through wikipedia 

Check the given number is palindrome or not

Leave a Comment

Your email address will not be published. Required fields are marked *