Write a programm create a 4*4 matrix.Display it also find the sum of upper triangle and product of lower triangle
Answers
Answer:
Step-by-step explanation:
Input : matrix[3][3] = {1 2 3
4 5 6
7 8 9}
Output :
Lower : 1 0 0 Upper : 1 2 3
4 5 0 0 5 6
7 8 9 0 0 9
Input : matrix[3][3] = {7 8 9
3 2 1
6 5 4}
Output :
Lower : 7 0 0 Upper : 7 8 9
3 2 0 0 2 1
6 5 4 0 0 4
Steps:
For lower triangular matrix, we check the index position i and j i.e row and column respectively. If column position is greater than row position we simply make that position 0.
For upper triangular matrix, we check the index position i and j i.e row and column respectively. If column position is smaller than row position we simply make that position 0.
Hope it helps you...