一道C语言编程题,初学者求教~

2024-12-01 18:18:31
推荐回答(1个)
回答1:

#include
int main()
{
int m,n,i,k,t,sum;
printf("Input m: ");
scanf("%d",&m);
printf("Input n: ");
scanf("%d",&n);
for(i=m;i<=n;++i)
{
t=i;
sum=0;
while(t)
{
k=t%10;
sum+=k*k*k;
t/=10;
}
if(sum==i)
{
printf("%d\n",i);
}
}
return 0;
}