Create a two dimensional array called matrix1 of size 3x3


Assignment

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 hard coding is acceptable.  You must accomplish this with as few lines of code as possible.

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Create a two dimensional array called matrix1 of size 3x3
Reference No:- TGS01520289

Now Priced at $40 (50% Discount)

Recommended (97%)

Rated (4.9/5)