第1个回答 推荐于2018-04-10
For[r = 100, r <= 999, r++,
If[r != (IntegerPart[
r/100])^3 + (IntegerPart[(r - 100*(IntegerPart[r/100]))/
10])^3 + (IntegerPart[
r - IntegerPart[r/100]*100 -
IntegerPart[(r - 100*(IntegerPart[r/100]))/10]*10])^3,
Continue[]]; Print[r]]
153
370
371
407
我这是Wolfram Mathematica程序,其他的你可以网上看看本回答被网友采纳
第2个回答 2021-03-16
#include <stdio.h>
int main()
{
int a,b,c,d,e;
printf("请输入一个3位整数\n");
scanf("%d",&a);
b=a/100;
c=a%100/10;
d=a%10;
e = b*b*b + c*c*c + d*d*d;
if(e == a)
printf("这个数是水仙花数",a);
else
printf("这个数不是水仙花数",a);
return 0;
}