Menu

[Solved]Java Write Test Method Takes Two Positive Integers M N Parameters Prints M Rows N Columns Q37217038

In java Write and test a method that takes any two positiveintegers m and n as parameters and prints m rows with n columns, asshown below (Assume m <= n).

The elements in the 1st row and column are all1.
The elements in the 2nd row and column are all 2 (exceptfor those in the 1st and last row and column).
The elements in the 3rd row and column are all 3 (exceptfor those in the 1st, 2nd, last and2nd-last row and column).
And soon.                                                                                   

Examples:

m = 5, n =7            m = 6, n =7             m = 9, n = 9 m = 2, n = 3

1 1 1 1 1 1 1        1 1 1 1 1 11         11 1 1 1 1 1 1 1 1 1 1

1 2 2 2 2 21        1 2 2 2 2 21         12 2 2 2 2 2 2 1 1 11

1 2 3 3 3 21        1 2 3 3 3 21         12 3 3 3 3 3 2 1

1 2 2 2 2 21        1 2 3 3 3 21         12 3 4 4 4 3 21

1 1 1 1 1 1 1        1 2 2 2 2 21         12 3 4 5 4 3 21

1 1 1 1 1 1 1    1 23 4 4 4 3 21

  1 2 3 3 33 3 21      

1 1 1 1 1 1 1 1 1   

Expert Answer


Answer to In java Write and test a method that takes any two positive integers m and n as parameters and prints m rows with n colu… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *