#include<stdio.h>
#include<math.h>
int main()
{
int num, a, b, c,total;
scanf("%d", &num);
a = num / 100;
b = num / 10 % 10;
c = num % 10;
total = pow(a, 3) + pow(b, 3) + pow(c, 3);
if (total == num)
printf("%d=%d的次方+%d的次方+%d的次方", num,a,b,c);
else
printf("不是水仙花数");
return 0;
}
原文:https://www.cnblogs.com/old-horse/p/12488872.html