You are viewing a single comment's thread. Return to all comments →
int main() { int A[3][3] = { {1, 2, 3}, {2, 3, 4}, {1, 1, 1} };
int B[3][3] = { {4, 5, 6}, {7, 8, 9}, {4, 5, 7} }; int C[3][3]; // Resultant matrix // Perform matrix addition: C = A + B for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { C[i][j] = A[i][j] + B[i][j]; } } // Print the resulting matrix printf("Resultant matrix (C = A + B):\n"); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { printf("%d ", C[i][j]); } printf("\n"); } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Linear Algebra Foundations #1 - Matrix Addition
You are viewing a single comment's thread. Return to all comments →
include
int main() { int A[3][3] = { {1, 2, 3}, {2, 3, 4}, {1, 1, 1} };
}