填空题
以下程序按下面指定的数据给x数组的下三角置数,并按如下形式输出:请填空。
4
3 7
2 6 9
1 5 8 10
#include<stdio.h>
main( )
int x[4][4],n=0,i,j;
for(j=0;j<4;j++)
for(i=3;i>=j; )n++;x[i][j]= ;
for(i=0;i<4;i++)
for(j=0;j<=i;j++) printf("%3d",x[i][j]);
printf("\\n");
【参考答案】
n
热门
试题
填空题
以下程序中函数fun的功能是:统计person所指结构体数组中所有性别(sex)为M的记录的个数,存入变量n中,并做为函数值返回。请填空:#include#define N 3typedef struct int num; char nam[10]; char sex;SS;int fun(SS person[]) int i, n=0;for(i=0; i<N; i++) if(______==’M’ ) n++;return n;main() SS W[N]=1, AA ,’F’,2, BB ,’M’,3, CC ,’M’; int n;n=fun(W); printf( n=%d n ,n);