求水仙花数
#include <stdio.h>
int main()
{
int a[100], b,i,c,d;
for (i = 0; a[i-1] != 0; i++)
{
scanf("%d", &a[i]);
}
for (i = 0; a[i] != 0; i++)
{
b = a[i] / 100;
c = a[i] % 10;
d = a[i] / 10 % 10;
if (b*b*b + c*c*c + d*d*d == a[i])
{
printf("Yes\n");
}
else
{
printf("No\n");
}
}
return 0;
}#include <stdio.h>
int main()
{
int a[100], b,i,c,d;
for (i = 0; a[i-1] != 0; i++)
{
scanf("%d", &a[i]);
}
for (i = 0; a[i] != 0; i++)
{
b = a[i] / 100;
c = a[i] % 10;
d = a[i] / 10 % 10;
if (b*b*b + c*c*c + d*d*d == a[i])
{
printf("Yes\n");
}
else
{
printf("No\n");
}
}
return 0;
}