forked from dipeshguptaa/python-program
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharm
More file actions
20 lines (16 loc) · 412 Bytes
/
arm
File metadata and controls
20 lines (16 loc) · 412 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Python program to check if the number is an Armstrong number or not
# take input from the user
num = int(input("Enter a number: "))
# initialize sum
sum = 0
# find the sum of the cube of each digit
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** 3
temp //= 10
# display the result
if num == sum:
print(num,"is an Armstrong number")
else:
print(num,"is not an Armstrong number")