Sunday, November 28, 2010

write a program To print armstrong number using while loop

#include

#include

main()

{

int n,t,s,r;

printf(“Ent er any number:”);

scanf(“%d”,&n);

t=n;

s=0;

while (n>0)

{

r=n%10;

s=s+(r*r*r);

n=n/10;

}

if(t==s)

printf(“%d is a Armstrong number”, t);

else

printf(“%d is not a Armstrong number”, t);

getch();

}