🧠 2D Array Practice Problems in C
✅ Problem 1: Input and Print a 2x2 Matrix
Write a program to take input for a 2x2 matrix and display the matrix.
Example:
Input: 1 2
3 4
Output:
1 2
3 4
✅ Problem 2: Sum of All Elements in a Matrix
Write a program to calculate the sum of all elements in a 3x3 matrix.
✅ Problem 3: Find Maximum Element in a 2D Array
Take a 3x3 matrix input from the user and display the maximum number.
✅ Problem 4: Row-wise Sum of a 2D Array
Write a program to compute and display the sum of each row in a 4x2 matrix.
✅ Problem 5: Transpose of a Matrix
Write a C program to find the transpose of a 3x3 matrix.
Hint: Transpose: B[i][j] = A[j][i]
✅ Problem 6: Multiply Two Matrices
Write a program to multiply two 2x2 matrices.
✅ Problem 7: Identity Matrix Check
Check if a 3x3 matrix is an identity matrix (1 on the diagonal, 0 elsewhere).
✅ Problem 8: Diagonal Sum of Square Matrix
Calculate the sum of the main diagonal of a 4x4 matrix.
✅ Problem 9: Count Zeros in a Matrix
Count how many zeros are in a given 5x5 matrix.
✅ Problem 10: Replace Negative Elements with Zero
Write a program that replaces all negative numbers in a 2D matrix with zero.