CPSC165

Assignment#1

 

                                               

Create a two dimensional array called Matrix1 of size 3X3.

Populate it with 1 through 9.

 Print Matrix1 row by row, it must look like:

1          2          3

4          5          6

7          8          9

Declare another array of same size called Matrix2

Transpose the contents of Matrix1 into Matrix2.

Print Matrix2 which must look like:

1          4          7         

2          5          8

3          6          9

Transpose of an array is when the contents of the row and column are reversed.  No extra variables are allowed.  No hardcoding is acceptable.  You must accomplish this with as few lines of code as possible.


 

 Create a two dimensional array called Matrix1 of size 3X3.

Populate it with 1 through 9.

 Print Matrix1 row by row, it must look like:

1          2          3

4          5          6

7          8          9

Pass Matrix1 to a function called diagonal, in which you will change only the diagonal values to zero.

Print Matrix1 which now looks like:

0          2          3         

4          0          6

7          8          0

 

No extra variables are allowed.  No hardcoding is acceptable.  You must accomplish this with as few lines of code as possible. 

 

 

 

    • 8 years ago
    A+ Work
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      qfiles35.docx