A-A+
以下程序是求矩阵a b的和 结果存入矩阵c中 并按矩阵形式输出 请填空。 include<s
问题详情
以下程序是求矩阵a,b的和,结果存入矩阵c中,并按矩阵形式输出,请填空。 include<stdio.h> main() { int a[3][4]={13,-2,7,5},{1,0,4,-3},{6,8,0,2}}; int b[3][4]={{-2,0,1,4},{5,-1,7,6},{6,8,0,2}}; int i,j,c[3][4]; for(i=0;i<3;i++) for(j=0;j<4;j++) c[i][j]=【 】; for(i=0;i<3;i++) { for(j=0;j<4;j++) printf("%3d",c[i][j]); printf("n");}}
请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:a[i][j]+b[i][j]
此题是双重for循环结构应用在了二维数组中。外层for循环用来控制二维数组的行,内层for循环控制二维数组的列。