/* Note:Your choice is C IDE */
#include "stdio.h"
void main()
{
int i,g,s,b,cont=0;// 定义变量
for(i=100;i<999;i++)
{
g=i%10; //个位
s=i/10%10; //十位
b=i/100; //百位
if(g*g*g+s*s*s+b*b*b==i)
{
printf("\n%d水仙花数",i);
cont++;
}
}
printf("\n100-999之间的水仙花数为:%d",cont);
}
153水仙花数
370水仙花数
371水仙花数
407水仙花数
100-999之间的水仙花数为:4