//求100到999的水仙花数
<pre name="code" class="cpp">#include<stdio.h>
#include<math.h>
void main()
{
int a,b,c,d;
for(a=1;a<=9;a++)
for(b=0;b<=9;b++)
for(c=0;c<=9;c++){
if(pow(a,3)+pow(b,3)+pow(c,3)==a*100+b*10+c)
printf("水仙花数是%d\n",a*100+b*10+c);
}
}