求1~10000之间所有满足各位数字的立方和等于它本身的数

求1~10000之间所有满足各位数字的立方和等于它本身的数


int main()
{                   
    for(int i=1;i<=10000;++i)
    {
        int sum=0;
        int temp=i;
        while(temp){
            sum+=(temp%10)*(temp%10)*(temp%10);
            temp/=10;
        }
        if(sum==i)
            printf("%d ",i);
    }    
}