oj刷题:打印出所有"水仙花数

jlqwer 发表于 代码 分类,标签:

Description

打印出所有"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该本身。例如:153是一个水仙花数,因为153=1^3+5^3+3^3。 Output:


153

???

???

??? 

Input


Output

所有的水仙花数,从小的开始。每行一个

#include<stdio.h>
 int main()
 {
     int a,b,c,s,x;
     for(s=100;s<1000;s++)
     {
     a=s/100;
     b=(s/10)%10;
      c=s-(a*100+b*10);
           x=(a*a*a+b*b*b+c*c*c);
         {
         if (s==x)

         printf("%d",s);
         }
     }
     return 0;
 }