Question: Write a program that prompts the user to enter the length of a square matrix, randomly fills in 0s and 1s into the matrix, prints
Write a program that prompts the user to enter the length of a square matrix, randomly fills in 0s and 1s into the matrix, prints the matrix, and finds the rows, columns, and diagonals with all 0s or 1s. Here is a sample run of the program:
Enter the size for the matrix: 4 0111 -Enter 0000 0100 1111 All 1s on row 3 No same numbers on a column No same numbers on the major diagonal No same numbers on the sub-diagonal
Step by Step Solution
3.41 Rating (160 Votes )
There are 3 Steps involved in it
Program to display the square matrix with randomly filled 0s and 1s Program plan Import the required packages into the program o Define the main function Create an object using scanner class Get the i... View full answer
Get step-by-step solutions from verified subject matter experts
