Palindrome Number


                            


                                     First, we see what is Palindrome number. If we are giving input as 4567 then program separates every integer no and rearrange it in a reverse manner and again see the original number is the same or not, the i.e. original number is 4567and reversed number is 7654 and it is not equal so the output is not palindrome. But if input is 12321 then the original number and reversed number is equal. So the output is Palindrome number. We see the demo of this code as follows:

Python code for Palindrome Number:
def Palindrome(Number):
        n=Number
        Reverse=0
        while n>0:
            Reminder=n%10
            Reverse=(Reverse*10)+Reminder
            n=n//10
        if(Number==Reverse):
                print(Number,'is a palindrome number')
        else:
                print(Number,'is not a palindrome number')
num=int(input("Enter a number: "))

Palindrome(num)

Output:
Enter a number: 12321
12321 is not an Armstrong number

Enter a number: 1245

1245 is not a palindrome number
Palindrome Number Palindrome Number Reviewed by Amit Waghmare on November 23, 2019 Rating: 5

No comments: