#include <stdio.h>
int fun(int x)
{
    int a, b, c;
    a = x / 100;
    b = x % 100 / 10;
    c = x % 10;
    if (x == a * a * a + b * b * b + c * c * c)
        return 1;
    else
        return 0;
}
int main()
{
    int m;
    printf("1000以内的水仙花数:\n");
    for (m = 100; m < 1000; m++)
    {
        if(fun(m)==1)
        printf("%5d\n", m);
    }

}

相关文章:

  • 2022-12-23
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2021-07-13
  • 2021-07-17
  • 2021-06-15
  • 2021-10-30
猜你喜欢
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
相关资源
相似解决方案