Armstrong number

Q. Write a program to check whether a number is a Armstrong number or not.


Definition of Armstrong number: An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself.
In other word “A number is Armstrong if it is equal the sum of cube of its digits.”
Example of Armstrong number is 371 because according to definition cube of its digits  sum will be equal to number so
Armstrong number 371=(3)3+(7)3+(1)3

/*program to check whether a number is Armstrong or not*/
int main()
 int n,num,rem,sum=0;
 printf("Enter any number : ");
 scanf("%d", &num);
 for(n=num; n>=1; n=n/10)
    printf("Number is Armstrong number");
    printf("Number is not Armstrong number");
 return 0;


Enter any number :254
Entered number is not Armstrong number
Enter any number : 371
Entered number is Armstrong number

Related Program:
  1. Amicable number C program
  2. Flowchart for checking number is Armstrong or not
  3. Perfect number C program
  4. Print Armstrong number range C program


  1. its not work for more than 3 digit number

  2. I would suggest you to look for Narcissistic Number C Program on Google

  3. if it is 4 digit number u can calculate as 4 instead of cube
    for exam : 4444 u can write it as
    4^4 4^4 4^4 4^4 like that