Question: Write a full java program that prompts the user for an integer n and then creates a two-dimensional array of type int of size nn.
Write a full java program that prompts the user for an integer n and then creates a two-dimensional array of type int of size nn. It should fill the array with random values between 0 and 20 using Random class or the Math.random method within a nested loop. Then, compute the sum of all elements in the diagonal of the array. Finally, display both the array and the sum of the elements of the diagonal.
v
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
