Amstong Nos upto a given Limit

Amstong Nos upto a given Limit

#include < stdio.h>
#include < conio.h>
main()
{
int i,j,a,k=0,n;
clrscr();
printf("\n enter the Limit:");
scanf("%d",&n);
for(a=1;a<=n;a++)
{
i=a;
k=0;
while(i!=0)
{
j=i%10;
k=k+(j*j*j);
i=i/10;
}
if(k==a)
printf("%d\n",a);
}
getch();
}

0 comments: