Saturday, December 24, 2011
8:33 PM

Write a Program to Find Armstrong Number



Program to Find Armstrong Number Between 1 to 500 (in c)




Here is c program to find armstrong number


#includevoid main(){ int a,b,c,d,i;printf("The armstrong number between 1 to 500 are : ");i = 1;//loop till 500while(i<=500){c=i;d =i;b = 0;a = 0;//checking each numberwhile(c>0){a = c%10;b +=a*a*a;c = c/10;}if(b==d)printf("\n%d",i);i++;}}

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.