#
Write a user defined function named lowerhalf() which takes a 2D array A, with size n rows and n cols as arguments and prints the lower half of the matrix

1
by J24shr33

Log in to add a comment

by J24shr33

Log in to add a comment

Certified answers contain reliable, trustworthy information vouched for by a hand-picked team of experts. Brainly has millions of high quality answers, all of them carefully moderated by our most trusted community members, but certified answers are the finest of the finest.

// i suppose it is a square matrix... lower and upper half...

#define m 10

#define n 10

#include <iostream>

int main()

{

int i,j, A[m][n];

lowerhalf(int &A[0][n], m, n);

return 1;

}

void lowerhalf(int **A, int m, int n)

{

int i, j;

for (i = 0; i < m; i++) { // in each row print as many as the row number

for (j =0; j < i ; j++) cout << A[i][j] << " " ;

cout << '\n';

}

}

#define m 10

#define n 10

#include <iostream>

int main()

{

int i,j, A[m][n];

lowerhalf(int &A[0][n], m, n);

return 1;

}

void lowerhalf(int **A, int m, int n)

{

int i, j;

for (i = 0; i < m; i++) { // in each row print as many as the row number

for (j =0; j < i ; j++) cout << A[i][j] << " " ;

cout << '\n';

}

}