Program to check the number is palindrome

# Compatible in Python 2.7

Number = int(raw_input("Please Enter any Number: "))
Temp=Number    # Number is stored to a temporary variable
Reverse = 0          # Initialize the reverse value to overcome garbage value storage
if Number<0:
    print 'Number is negative'
elif Number ==0:
    print 'Reverse Number is',Number
elif Number>0:
    while(Number > 0):
      Reminder = Number %10
      Reverse = (Reverse *10) + Reminder
      Number = Number /10
    print 'Reverse of a Number is',Reverse
else:
    exit()

if Temp==Reverse:
    print 'The number is palidrome'
else:
    print 'The number is not palidrome'


No comments: