C Program to Check Armstrong Number
x
22
22
1
2
3
void main()
4
{
5
int n, q, rem, s=0;
6
clrscr();
7
printf("Enter the integer number:");
8
scanf("%d",&n);
9
q=n;
10
while(q>0)
11
{
12
rem=q%10;
13
s=s+(rem*rem*rem);
14
q=q/10;
15
}
16
if(n==s)
17
printf("It is Armstrong number! %d",n);
18
else
19
printf("It is not Armstrong number! %d",n);
20
getch();
21
}
22
Output :
Enter the integer number: 153
It is Armstrong number!