Computer Science, asked by dipshikhachatte4216, 1 year ago

Write a c program find sum of lower triangular elements in a matrix.

Answers

Answered by manjusreem97
0

Answer:

#include<stdio.h>

#define max_rows 3

#define max_cols 3

int main()

{

int A[max_rows][max_cols];

int row,col,sum=0;

printf("enter elements in matrix of size %d×%d:\n",max_rows,max_cols);

for(row=0;row<max_rows;row++)

{

for(col=0;col<max_cols;col++)

{

scanf("%d",&A[row][col]);

}

}

for(row=0;row<max_rows;row++)

{

for(col=0;col<max_cols;col++)

{

if(col<row)

{

sum+=A[row][col];

}

}

}

printf("sum of lower triangular matrix=%d",sum);

return 0;

}

Explanation:

Similar questions