Skip to content

Commit 2b64dcc

Browse files
authored
Armstrong Number
Added a python program to check if the number is an Armstrong Number or not
1 parent bc006ea commit 2b64dcc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ArmstrongNumberCheck.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
print("An Armstrong Number is a number which is equal to the sum of the cubes of it's digits.")
2+
inputNumber = input("Enter a number to check if it's an Armstrong Number or not: ")
3+
sumOfCubes=0
4+
5+
for digit in inputNumber:
6+
sumOfCubes+=int(digit)**3
7+
8+
if sumOfCubes==int(inputNumber): print(inputNumber,"is an Armstrong Number.")
9+
else: print(inputNumber,"is NOT an Armstrong Number.")

0 commit comments

Comments
 (0)