Lab 7 & 8 Tasks
Lab 7 & 8 Tasks
- Create a 2D array in the main function with dimensions entered by the user (rows x
cols).
- Prompt the user to input the elements of the matrix.
- Traverse and print the original matrix using nested loops, directly in the main function.
- Uses nested loops to compute the transpose of the matrix by swapping rows and
columns. (Hint: transposed[j][i] = array[i][j])
- Traverse and print the transposed matrix using nested loops, directly in the main
function.
Original Matrix:
123
456
Transposed Matrix:
14
25
36
Task # 02: Matrix Multiplication Using User-Defined Functions
Matrix Creation in Main Function:
- Create two 2D arrays in the main function: matrixA and matrixB, with user-defined
dimensions.
- Ensure that the number of columns in matrixA equals the number of rows in matrixB
- Prompt the user to input the elements of both matrices.
- Traverse and print both matrixA and matrixB in the main function, using nested loops.
- Return the resultMatrix from your user-defined function to the main function.
- In the main function, traverse and print the resultMatrix after the function call.
Matrix A:
123
456
Matrix B:
78
9 10
11 12
Resultant Matrix:
58 64
139 154