/*Find the sum of two matrices*/
#include<stdio.h>
void main() {
int i, j;
int A[3][5] = { { 2, 1, 3, 7, 6 }, { 8, 13, 4, 0, 1 }, { 1, 2, 3, 4, 5 } },
B[3][5] = { { 0, 1, 2, 3, 4 }, { 9, 1, 2, 6, 7 }, { 4, 0, 3, 7, 1 } },
C[3][5];
for (i = 0; i < 3; i++)
for (j = 0; j < 5; j++)
C[i][j] = A[i][j] + B[i][j];
printf("\nThe matrix C is:\n");
for (i = 0; i < 3; i++) {
for (j = 0; j < 5; j++)
printf("%3d ", C[i][j]);
printf("\n");
}
}
WHAT'S NEW?
Loading...
0 comments:
Post a Comment