Skip to content

Commit 2926ef2

Browse files
authored
Added the Armstrong program
1 parent 312c5f4 commit 2926ef2

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

armstrong.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# https://www.facebook.com/mayankgbrc/posts/2726954114288546
2+
# Subscribed by Code House
3+
num = int(input("Enter a number: "))
4+
5+
sum = 0
6+
7+
temp = num
8+
while temp > 0:
9+
digit = temp % 10
10+
sum += digit ** 3
11+
temp //= 10
12+
13+
if num == sum:
14+
print(num,"is an Armstrong number")
15+
else:
16+
print(num,"is not an Armstrong number")

0 commit comments

Comments
 (0)