刚刚学习c语言,一道水仙花数的题目不知错在哪里,希望能有大神帮忙指正
int n;n = 3;
int first = 1;
int num = 1;
for(; first <n; first++){
num *= 10;
}
for(num; num <num*10; num++){
int sum = 0;
int j = 1;
do{
int num2 = num%10;
int t = num2;
num /= 10;
while(j < n){
t *= num2;
j++;
}
sum += t;
if(sum == num){
printf("%d\n",num);
}
}while(num > 0);
}