计算机二级C语言上机考试填空题及答案1

全国等级考试资料网 2019-01-23 14:14:57 84
填空题
请补充main函数,该函数的功能是:输出一个N*N矩阵,要求非周边元素赋值0,周边元素赋值1。
仅在横线上填入所编写的若干表达式或语句,勿改动函数中的其他内容。
#include
#define N 10
main()
{
int bb[N][N];
int i, j, n;
printf(" Input n: ");
scanf("%d", &n);
for (i=0; ifor (j=0; j{
if (i==0||i==n-1||j==0||j==n-1)
___1___;
else
___2___;
}
printf(" ***** the result ******* ");
for (i=0; i{
printf(" ");
for (j=0; jprintf("%4d", bb[i][j]);
}
}
参考答案
第1处填空:bb[i][j]=1
第2处填空:bb[i][j]=0 相关资料

相关阅读