Skip to content

Commit 8099fa8

Browse files
authored
Merge pull request dipeshguptaa#6 from githubfordipesh/patch-6
arm
2 parents cb88b10 + 7ed684d commit 8099fa8

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

arm

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Python program to check if the number is an Armstrong number or not
2+
3+
# take input from the user
4+
num = int(input("Enter a number: "))
5+
6+
# initialize sum
7+
sum = 0
8+
9+
# find the sum of the cube of each digit
10+
temp = num
11+
while temp > 0:
12+
digit = temp % 10
13+
sum += digit ** 3
14+
temp //= 10
15+
16+
# display the result
17+
if num == sum:
18+
print(num,"is an Armstrong number")
19+
else:
20+
print(num,"is not an Armstrong number")

0 commit comments

Comments
 (0)