请问我的代码为什么运行没有结果 可以帮我看看吗
我的思路是遍历1000-9999之间的所有四位数,
拆分四位数并求其立方和
将sum与数本身比较,如果相等则为玫瑰花数
以下为我写的代码
#include <stdio.h>
int main()
{
int i,t,temp,sum=0;
printf("四位玫瑰花数有:");
for(i=1000; i<=9999; i++)
{
t=i;
while(t!=0)
{
temp=t%10;
sum+=temp*temp*temp*temp;
t=t/10;
}
if(sum==i)
printf("%d\t",i);
}
}