ZKX's LAB

1000以内的水仙花数 1000以内水仙花数是哪些

2021-04-06知识12

c++ 输出1000以内的水仙花数 #includevoid main(){int i=100;int a,b,c;while(i)/水仙花数是三位数吧~{a=i/100;b=i/10%10;c=i%10;if(i=a*a*a+b*b*b+c*c*c)/水仙花数是3次方,不是平方cout;i+;应该在后面}}呵呵

水仙花数有哪些? 你好,水仙花数是指一个 n 位数(n≥3),它的每个位上的数字的 n 次幂之和等于它本身.(例如:1^3+5^3+3^3=153).三位的水仙花数共有4个:153,370,371,407.

用C语言 求1000以内的水仙花数 #includeusing namespace std;void main(){int m=1,n=0,x=0;cout以内的所有水仙花数数:\";for;m;m+){x=m/100;n+x*x*x;x=m%100/10;n+x*x*x;x=m%100%10;n+x*x*x;if(n=m){cout;}n=0;}cout;}

#1000以内的水仙花数求和#判断100到1000的水仙花数c语言#求1000以内的水仙花数

随机阅读

qrcode
访问手机版