#include<stdio.h>
int main()
{
int s=0,l;
long n,t;
printf("Enter Three Digit Number : ");
scanf("%ld",&n);
t=n;
while(n>0) //Here, we can use (n!=0)
{
l=n%10;
s=s+(l*l*l);
n=n/10;
}
if(s==t)
printf("%ld Armstrong Number",t);
else
printf("%ld Not Armstrong Number",t);
return 0;
}
#include <stdio.h>
#include <math.h>
int main()
{
int num, t, r, s = 0, count = 0 ;
printf("Enter Number : ");
scanf("%d", &num);
t = num;
while (t>0)
{
t=t/10;
++count;
}
t = num;
while (t > 0)
{
r = t%10;
s=s+ pow(r, count);
t=t/10;
}
if(s == num)
printf("\n%d Armstrong Number.", num);
else
printf("\n%d NOT Armstrong Number.", num);
return 0;
}