Learn basic concept of c , c++ and python programming in regularcodes.com

Spread the post

Print lower triangular matrix

Write an efficient algorithm to print lower triangular matrix in 2d array.

For example.

View matrix in array form

Stack Areamainarray [3,3] [0][0] 1[0][1] 2[0][2] 3[1][0] 4[1][1] 5[1][2] 6[2][0] 7[2][1] 8[2][2] 9col (int) =3row (int) =3

Program to display lower triangular matrix in c. Time complexity O(n).

Output

View process.

Stack Areamainarray [3,3] [0][0] 1[0][1] 2[0][2] 3[1][0] 4[1][1] 5[1][2] 6[2][0] 7[2][1] 8[2][2] 9col (int) =3row (int) =3lower_t_matrixarray(pointer)col (int) =3i (int) =1j (int) =0row (int) =3

View steps of execution

Submit your solution in comment section.

Spread the post

Recommended Posts: