给你个函数参考下(自己写个主程序就可以了)
int
Is_Narcissistic(int
n)
//是否水仙花数,1表示是水仙花数,0表示不是
{
int
i,m,ct,b[20];
if
(n<100)
//3位以下没有
return
0;
m=n;
ct=0;
while(m!=0)
{
b[ct++]=m%10;
m/=10;
}
for(i=0;i
m+=(int)pow(b[i],ct);
if
(m==n)
return
1;
return
0;
}