#include <stdio.h>
void printLowerTriangular(int matrix[][3], int rows, int cols) {
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
if (i < j) {
printf("0 ");
}
else {
printf("%d ", matrix[i][j]);
}
}
printf("\n");
}
}
int main()
{
int matrix[ ][3] = { {1, 2, 3},
{4, 5, 6},
{7, 8, 9} };
int rows = (sizeof(matrix)/sizeof(matrix[0]));
int cols = (sizeof(matrix)/sizeof(matrix[0][0]))/rows;
printLowerTriangular(matrix, rows, cols);
return 0;
}
/*
run:
1 0 0
4 5 0
7 8 9
*/