while(i>1) { cube=0; temp=i; while(temp>0) { mod=temp%10; temp=temp/10; cube=cube+mod*mod*mod; } if(cube==i){ printf("%d", cube); } i--; }