Print the Armstrong numbers between the two intervals | faceprep

Print the Armstrong numbers between the two intervals | faceprep

The program to print all the Armstrong numbers between the two intervals is discussed here. A number is said to be an Armstrong number when the sum of nth power of digit of the number is equal to the number itself.


print-the-armstrong-numbers-between-the-two-intervals




Print the Armstrong numbers between two intervals Algorithm to print Armstrong numbers between two intervals

  1. Input the start and end values.
  2. Repeat from i = start_value to end_value.
  3. Repeat until (temp != 0)
  4. remainder = temp % 10
  5. result = result + pow(remainder,n)
  6. temp = temp/10
  7. if (result == number)
  8. Print the number
  9. Repeat steps from 2 to 8 until the end_value is encountered.


Print the Armstrong numbers between two intervals

Program to print the Armstrong numbers between the two intervals

@@coding::1@@


Time complexity: O(n)



Recommended Programs








Print the Armstrong numbers between two intervals

c