Problem Description
Write a program to find the armstrong numbers between the given range
Input 1:Lower Range
Input 2: Upper range
Output:
List of Armstrong numbers
Refer sample input and output for formatting specification.CODING ARENA
lower=int(input())
upper=int(input())
for num in range(lower, upper + 1):
order = len(str(num))
sum = 0
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** order
temp //= 10
if num == sum:
print(num)
Test Case 1
Input (stdin)100
2000Expected Output153
370
371
407
1634Test Case 2
Input (stdin)100
1000Expected Output153
370
371
407
✖
Share this Posts
Subscribe Our Newsletter
0 Comment
Post a Comment