Skip to content

Commit f6b8826

Browse files
author
codehouseindia
authored
Merge pull request codehouseindia#1 from mayankgb2/patch-1
Added the Armstrong program
2 parents 312c5f4 + 2926ef2 commit f6b8826

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)