C Programming Code Examples C > Arrays and Matrices Code Examples C program to find sum of lower triangular matrix C program to find sum of lower triangular matrix Write a C program to read elements in a matrix and find sum of lower triangular matrix. How to find sum of lower triangular matrix in C. To find sum of lower triangular matrix, we need to find the sum of elements marked in the red triangular area. For any matrix A sum of lower triangular matrix elements is defined as sum = sum + Aij (Where j < i). #include <stdio.h> #define maxrows 3 #define maxcols 3 int main() { int A[maxrows][maxcols]; int row, col, sum = 0; /* Input elements in matrix from user */ printf("Enter elements in matrix of size %dx%d: \n", maxrows, maxcols); for(row=0; row<maxrows; row++) { for(col=0; col<maxcols; col++) { scanf("%d", &A[row][col]); } } /* Find sum of lower triangular matrix */ for(row=0; row<maxrows; row++) { for(col=0; col<maxcols; col++) { if(col<row) { sum += A[row][col]; } } } printf("Sum of lower triangular matrix = %d", sum); return 0; }