Stay Tuned!

Subscribe to our newsletter to get our newest articles instantly!

C++ Programming

C++ Program to Print Armstrong Number from 1 – 500

Print Armstrong Number

Write a Program to Print the Armstrong Number from 1 – 500.

When a number’s digits are raised to the power of the number of digits, the number itself is considered an Armstrong number. Among them are 0, 1, 153, 370, 371, 407, 1634, 8208, 9474, and many more three-digit Armstrong numbers.

Algorithm for Armstrong Number

  • Start the program.
  • i=1
  • if (i<=500) then goto step 4 else goto step 9
  • s=0, j=i
  • if (j!=0) then goto step 6 ese goto step 8
  • s=s+(pow(i%10),3)), j=j/10
  • if (s=i) then display i
  • i=i+1
  • End the program

Source Code



using namespace std;

int main() {

    int i, j, s;

        for(i=1; i<=500; i++){


            for(j=i; j!=0; j=j/10){

                s=s+(pow((j%10), 3));              







pow function



About Author provides tutorials related to tech and programmings. We are also setting up a community for the users and students.

You may also like

program to find leap year
C++ Programming

C++ Program to Find Leap Year by Using Function

  • March 3, 2016
Write a program to find if the inputted year is a leap year or not by using the concept of