输出所有的“水仙花数”,所谓“水仙花数”是指一个三位数,其各位数字的立方和等于该数本身。例如:153是一个“水仙花数”,因为153 = 1的三次方 + 5的三次方 + 3的三次方。 程序分析:利用for循环控制100-999之间的数,每个数分解出个位、十位、百位。 void main______ { int i, j, k, n; printf ______ ; for(n=100; n<1000; n++){ ( ______ ) /*分解出百位*/ ( ______ ) /*分解出十位*/ ( ______ ) /*分解出个位*/ if ______ { printf ("%-5d",n); } ( ______ ) /*换行,准备输出下一个数*/ } }
查看答案
结构数组中存有三人的姓名和年龄,以下程序输出三人中最年长者的姓名和年龄。请填空。 #include "stdio.h" static struct man { ( ______ ) /*在结构体中定义一个字符数组,用来存储姓名信息*/ int age; }person[ ]={ "li-ming",18, "wang-hua",19,"zhang-ping",20}; void main______ { struct man *p,*q; int old=0; p = person; for ( ;( ______ ); ( ______ )) if ______ { q=p; /*用q来指向当前年龄最大的人*/ ______ (______ ______ ______ ); } printf ("%s %d\n", ( ______ ); ( ______ ) ); }
#include "stdio.h" void main() { int a, i, aa[4], t; scanf ("%d", &a); aa[0]=a%10; aa[1]=a%100/10; aa[2]=a%1000/100; aa[3]=a/1000; for (i=0; i<=3; i++) { aa[]+=5; aa[]%=10; } for (i=0; i<=3/2; i++) {
A. (=3;
B. >=0;
C. --) printf("%d", aa[i]); } 验证上面程序的结果,并分析该程序能够完成什么功能?
For the arm, wrist injuries were most common.()
A. 对于手臂而言,手腕受伤是最常见的。
B. 手臂手腕都是最容易受伤的。
Good habits promote longevity. ()
A. 良好的习惯能增进健康。
B. 良好的习惯能增长寿命。