write a program to find armstrong numbers in the given range A to B (including A and B). an N -digit number is armstrong number if the number is equal to the sum of the Nth power of its digits.
1
Expert's answer
2021-10-27T16:22:39-0400
a = int(input("A = "))
b = int(input("B = "))
nums = []for n inrange(a, b+1):
if n == sum([int(i)**len(str(n)) for i in str(n)]):
nums.append(n)
print(f"Armstrong numbers in the range {a} to {b}:")print(*nums, sep=',')
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments