Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int matrixA[10][10], matrixB[10][10], add[10][10], sub[10][10], row, col, r = 3, c = 3;
- puts("Enter A matrix row by row: ");
- for (row = 0; row < r; row++) {
- for (col = 0; col < c; col++)
- scanf("%d", &matrixA[row][col]);
- }
- puts("Enter B matrix row by row: ");
- for (row = 0; row < r; row++) {
- for (col = 0; col < c; col++)
- scanf("%d", &matrixB[row][col]);
- }
- for (row = 0; row < r; row++) {
- for (col = 0; col < c; col++) {
- add[row][col] = matrixA[row][col] + matrixB[row][col];
- sub[row][col] = matrixA[row][col] - matrixB[row][col];
- }
- }
- puts("Addition:");
- for (row = 0; row < r; row++) {
- for (col = 0; col < c; col++)
- printf("%d", add[row][col]);
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement