Write a python function to check if a number given is a Armstrong number
Topic: Write a python function to check if a number given is a Armstrong number
Solution
def isArmstrong(x): n = 0 while (x != 0): n = n + 1 x = x // 10 temp = x sum1 = 0 while (temp != 0): r = temp % 10 sum1 = sum1 + r ** n temp = temp // 10 return (sum1 == x)
List all Python Programs