Check if a Number is Palindrome or Not in Python
A palindromic number is a number that remains the same when its digits are reversed. In other words, it has reflectional symmetry across a vertical axis. The term palindromic is derived from palindrome, which refers to a word whose spelling is unchanged when its letters are reversed.
Program:
reverse=0; remainder=0;
num=int(input("Enter an integer: "))
temp=num;
while(temp!=0):
remainder=temp%10;
reverse=reverse*10+remainder;
temp//=10;
if(reverse==num):
print(num, "is a palindrome number");
else:
print(num, "is not a palindrome number");
OutPut:
No comments:
Post a Comment