create account

Python Program to Find Armstrong Number in an Interval by python-dev

View this thread on: hive.blogpeakd.comecency.com
· @python-dev ·
$0.50
Python Program to Find Armstrong Number in an Interval
``` 
# Program to check Armstrong numbers in a certain interval

lower = 100
upper = 2000

for num in range(lower, upper + 1):

   # order of number
   order = len(str(num))
    
   # initialize sum
   sum = 0

   temp = num
   while temp > 0:
       digit = temp % 10
       sum += digit ** order
       temp //= 10

   if num == sum:
       print(num)
 ```
👍  ,
properties (23)
authorpython-dev
permlinkpython-program-to-find-armstrong-number-in-an-interval
categorypython-dev
json_metadata{"tags":["python-dev"],"app":"hiveblog/0.1","format":"markdown"}
created2020-03-22 10:19:33
last_update2020-03-22 10:19:33
depth0
children0
last_payout2020-03-29 10:19:33
cashout_time1969-12-31 23:59:59
total_payout_value0.252 HBD
curator_payout_value0.252 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length358
author_reputation5,457,648,648,750
root_title"Python Program to Find Armstrong Number in an Interval"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id96,537,442
net_rshares1,595,590,001,914
author_curate_reward""
vote details (2)