Python - WAP to Check if a Number is Palindrome or Not in Python - 06
Source Code:
#!/usr/bin/python3
while True:
    num = int(input("Enter a Number : "))
    rev = 0
    n = num
    while (num > 0):
        rem = num % 10
        rev = rev * 10 + rem
        num = num // 10
    if (rev == n):
        print ("Num '%d', is a Palindrome!" % (n))
    else:
        print ("Num '%d', is Not a Palindrome!" % (n))
    print ("- Codegig.org")
    if (input("To Continue ['y'/n] ")) == 'y':
        continue
    else:
        break
Program Output:
....


Post a Comment