Computer Science, asked by J24shr33, 1 year ago

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

Answers

Answered by kvnmurty
2
// 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';
       }
}


kvnmurty: click on thanks button above please
Similar questions