Explore
ProGrad Programs
Placement Prep
TCS Codevita
Live Placement Training
Webinars
About Us

Edit
Reply




Edit

Print the Armstrong numbers between two intervals | FACE Prep

Published on 10 Mar 2020

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.

armstrong number 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.


Program to print the Armstrong numbers between the two intervals


C
C++
Java
Python 3

Output
Input- Enter start value and end value: 100 500 Output- Armstrong numbers between 100 and 500 are:370 371 407


Time complexity: O(n)


Recommended Programs






If you have any feedback about this article and want to improve this, please write to enquiry@faceprep.in