6.10水仙花数

来源:互联网 发布:网络自由度排名 编辑:程序博客网 时间:2024/06/08 18:11
#include <stdio.h>#include <stdlib.h>int main(){    int a,b,c,n;    for(n=100;n<1000;n++)    {        a=n/100;        b=(n/10)%10;        c=n%10;        if(n==a*a*a+b*b*b+c*c*c)            printf("n=%d\n",n);    }    return 0;}

这里写图片描述
知识点:分离各位数
心得体会:学会各位数的分离

原创粉丝点击