//找出100到999之间的水仙花数 #include<stdio.h> int main (void) { int m,n,k; int a = 0,b = 0,c = 0; scanf("%d%d",&m,&n); for(k = m;k <= n;k++) { a = k / 100; b = (k - 100 * a) / 10; c = k - 100 * a - 10 * b; if(k == a*a*a + b*b*b + c*c*c) printf("%d\n",k); } return 0; }
[此贴子已经被作者于2020-10-17 13:12编辑过]