# C language Two Dimensional (Matrix) solved programs/examples

A two-dimensional array is an array of arrays that has two values 1) number of rows and 2) number of columns in each row. It can be considered as a matrix with rows and columns.

Syntax to declare a two-dimensional array in C,

```type array_name[rows] [columns];
```

This section contains solved C programs on two-dimensional arrays, practice these programs to learn the concept of array of arrays or two-dimensional array (matrix) in C language. Each program has solved code, output, and explanation.

## List of C Two-dimensional Arrays Programs

1. C Program to Read and Print a RxC Matrix, R and C must be input by the User
This program will read a two dimensional array (Matrix), number of rows (R) and number of columns (C) will be read through the User.
2. C Program to Read a Matrix and find Sum and Product of all elements
This program will read a matrix and prints sum and product of all elements of the two dimensional array.
3. C Program to find Sum of all elements of each row of a matrix
This C program will read a Matrix (two dimensional arrays) and print the sum of all elements of each row.
4. C Program to Transpose a Matrix
This C program will read a matrix and print its transpose matrix.
5. C Program to Read a Matrix and Print Diagonals
This C program will read a matrix of MxN dimensions and prints only diagonal’s elements of the matrix.
6. C Program to find sum and subtraction of two matrices
This C program will read two matrices and find their sum (addition) and subtraction, in addition matrix addition of both matrixes’ elements will be assigned and in the subtraction matrix, subtraction of both matrixes’ elements will be assigned.
7. C Program to find multiplication of two matrices
This C program will read two matrices and make a third matrix, which will contain the multiplication of both input matrices.
8. C Program to print lower diagonal of a matrix
This C program will read a square matrix and print its lower diagonal.
9. C program for matrix multiplication using recursion
Given two matrices, we have to find their multiplication using the recursion.
10. C program to check two matrices are identical or not
Given two matrices, we have to check whether they are identical or not using C program.
11. C program to check a given matrix is an identity matrix or not
Given a matrix, we have to check whether the matrix is an identity matrix or not using C program.
12. C program to check a given matrix is a sparse matrix or not
Given a matrix, and we have to check whether the matrix is a sparse matrix or not using C program.
13. C program to interchange the rows in the matrix
Given a matrix, and we have to interchange the specified rows in the matrix using C program.
14. C program to interchange the columns in the matrix
Given a matrix, and we have to interchange the specified columns using C program.
15. C program to arrange row elements in ascending order
Given an array, we have to arrange the row elements in ascending order using C program.
16. C program to arrange column elements in ascending order
Given a matrix, we have to arrange column elements in ascending order using C program.
17. C program to find the frequency of even numbers in matrix
Given a matrix, we have to find the frequency of even numbers in matrix using C program.
18. C program to find the sum of main and opposite diagonal elements of a matrix
Given a matrix, we have to find the sum of main and opposite diagonal elements of a matrix using C program.
19. C program to find the normal of a matrix
Given a matrix, we have to find the normal of a matrix using C program.
20. C program to find the trace of matrix
Trace of a n x n square matrix is sum of diagonal elements. Given a square matrix, we have to find the trace of matrix.
21. C program to print the upper triangular matrix
Given a 3x3 matrix, we have to print the upper triangular matrix using C program.