输入1000以内的正整数,判断是否为水仙花数
int ge, shi, bai, a;
while (1) //The loop structure facilitates multiple data inputs.
{
printf("please input a number:");
scanf_s("%d", &a);
ge = a % 10;
shi = a / 10 % 10;
bai = a / 100;
if (a > 1000) //Number of daffordils within 1000.
printf("error data!");
else
{
if (a == ge * ge * ge + shi * shi * shi + bai * bai * bai)
printf("%d是水仙花数\n", a);
else
printf("%d不是水仙花数\n",a);
}
}