Posts

Showing posts from March 12, 2021

Matrix - Nine Submatrices

Matrix - Nine Submatrices  PROBLEM STATEMENT : The program must accept an integer matrix of size N*N as the input. The program must divide the given matrix into 9 submatrices based on the following conditions.  - The program must divide the given matrix into four submatrices of equal size.  - Then the program must divide the top-right submatrix horizontally into two submatrices of equal size.  - Then the program must divide the bottom-left submatrix vertically into two submatrices of equal size.  - Then the program must divide the bottom-right submatrix into four submatrices of equal size.  Finally, the program must print the sum of integers in each submatrix as the output.  Note: The value of N is always a multiple of 4.  Boundary Condition(s):   4 <= N <= 100  0 <= Matrix element value <= 1000  Input Format:   The first line contains N.  The next N lines, each contains N integers separated by a space. ...