Python for Engineers
Solve Problems by Coding Solutions - A Complete solution for python programming
Blog Pages
Blog
News
Distributions
NumPy Tutorials
Self Learning
IDE
Packages
About
Find the Armstrong Number upto a number
# Compatible in Python 2.7
k=int(raw_input('Enter the range of number:'))
for n in range(k):
sum=0
temp=n
y=len(str(n))
while(n>0):
R=n%10
V=R**y
sum=sum+V
n=n/10
if (sum==temp):
print 'Armstrong Number',temp
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment