Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Python/Armstrong_Number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# A number that equals to the sum of its own digits, where each digit raised to the power of number of digits is known as Armstrong Number.

num = int(input("Enter the Number: "))

temp = num
noOfDigit = 0
res = 0
while num>0:
num = int(num/10)
noOfDigit = noOfDigit+1
num = temp
while num>0:
rem = num%10
pow = 1
i = 0
while i<noOfDigit:
pow = pow*rem
i = i+1
res = res+pow
num = int(num/10)

if res==temp:
print("\nThe number is an Armstrong Number")
else:
print("\nThe number is not an Armstrong Number")