c-programs-basics
In this C program, we are going to find whether an entered number by user is an Armstrong number or Not.
What is an 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.
For example, 153 is an Armstrong number since 1*1*1 + 5*5*5+ 3*3*3= 153. 

C Program To Find Armstrong Number

#include<stdio.h>
#include<conio.h>
void main()
{
 int n,c,d,s=0,num;
 clrscr();

 printf("\n Enter Any Number : ");
 scanf("%d",&n);

 num=n;

 do
 {
  d=n%10;
  c=d*d*d;
  s=s+c;
  n=n/10;
 }while(n!=0);

 if(s==num)
   printf("\n %d is Armstrong Number",num);

 else
   printf("\n %d is Not an Armstrong Number",num);

 getch();

}

Output : 
armstrong-number-c-program

not-an-armstrong-number







In this way we can check armstrong number in c. Also check, how we can find armstrong numbers in a given range.