Skip to content

Commit 074c75f

Browse files
authored
Created By Atharva Shukla
1 parent c825bb9 commit 074c75f

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Atharva_35.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Simple program in python for checking for armstrong number
2+
# Python program to check if the number is an Armstrong number or not
3+
4+
y='y'
5+
6+
while y == 'y': # while loop
7+
# take input from the user
8+
x = int(input("Enter a number: "))
9+
10+
sum = 0
11+
12+
temp = x
13+
while temp > 0: #loop for checking armstrong number
14+
digit = temp % 10
15+
sum += digit ** 3
16+
temp //= 10
17+
18+
if x == sum:
19+
print(x,"is an Armstrong number")
20+
else:
21+
print(x,"is not an Armstrong number")
22+
23+
y=input("WNamt to continue?(y/n)") #Condition for multiple run
24+

0 commit comments

Comments
 (0)