Python program to check the given number is Adam’s number

Hello everyone, welcome to nkcoderz.com. In this article we will going to discuss about Python program to check the given number is Adam’s number.

Here is an example of a Python program that checks if a given number is an Adam number:

Code for Python program to check the given number is Adam’s number

def reverseDigits(num) :
    rev = 0
    while (num > 0) :
        rev = rev * 10 + num % 10
        num //= 10
         
    return rev
 
# To square number
def square(num) :
    return (num * num)
     
# To check Adam Number
def checkAdamNumber(num) :

    a = square(num)
    b = square(reverseDigits(num))
         

    if (a == reverseDigits(b)) :
        return True
    else :
        return False

num = int(input("Enter your number "))
if (checkAdamNumber(num)) :
    print ("Adam Number")
else :
    print ("Not a Adam Number")
 

Output

Enter your number 13
Adam Number

Python program to check whether the given number is an Armstrong number

Conclusion

If you liked this post, then please share this with your friends and make sure to bookmark this website for more awesome content.


If You Like This Page Then Make Sure To Follow Us on Facebook, G News and Subscribe Our YouTube Channel. We will provide you updates daily.
Shares
facebook sharing button Share
twitter sharing button Tweet
whatsapp sharing button Share
telegram sharing button Share
pinterest sharing button Pin

Leave a Comment