Skip to content

Commit aeaa5ac

Browse files
committed
# Python program to check if the number is an Armstrong number or not
1 parent 3857184 commit aeaa5ac

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

armstrong.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
num = int(input("Enter a number: "))
3+
sum = 0
4+
temp = num
5+
while temp > 0:
6+
digit = temp % 10
7+
sum += digit ** 3
8+
temp //= 10
9+
10+
if num == sum:
11+
print(num,"is an Armstrong number")
12+
else:
13+
print(num,"is not an Armstrong number")

0 commit comments

Comments
 (0)