Computer Science, asked by 007rsgagdeeps, 11 months ago

Write a Python Program to display weather a given number is an
Armstrong number or not.​

Answers

Answered by nivabora539
1

Answer:

n=int(input("Enter any number: ")) a=list(map(int,str(n))) b=list(map(lambda x:x**3,a)) if(sum(b)==n): print("The number is an armstrong number. ") else: print("The number isn't an arsmtrong number. ")

Answered by sherinabb4
2

Answer:

A number is called Armstrong number if it is equal to the sum of the cubes of its own digits.

For example: 153 is an Armstrong number since 153 = 1*1*1 + 5*5*5 + 3*3*3.

num = int(input("Enter a number: "))

sum = 0

temp = num

while temp > 0:

digit = temp % 10

sum += digit ** 3

temp // =10

if num == sum:

print(num,"is an Armstrong number")

else:

print(num,"is not an Armstrong number")

Similar questions