logo

Crowdly

You are given a ROWS x COLS integer matrix called mat , and another array calle...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

You are given a ROWS x COLS integer matrix called mat, and another array called shift of ROWS numbers. (ROWS and COLS are #defined constants). You have to circularly shift the numbers of each row of mat to the right by the number of positions mentioned in the corresponding value in the shift array. Your C program should print the modified matrix along with column-wise totals. Here is an illustrative example:

   	mat	 	   shift			     mat 

3      4      -2      16         1    16      3   4     -2

12     76     0       5          4   after right shifting  12   76   0      5

16     7      100     -70  6        ---------->      100   -70     16      7

   -----------------------

   128     9  20     10

   -----------------------

Note that the shift operation is not valid for negative numbers (which means negative input in shift array should be appropriately dealt with). Your program should be commented well, written modularly, and use the following functions that you must define and use, in addition to any others you may wish to write:

void populateMatrix(); /* takes values into the matrix */

void RightShiftRow(); /* shifts a given row by the value specified */

void printMatrixAndColTotals();

More questions like this

Want instant access to all verified answers on dle.plaksha.edu.in?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!