Question: Write a Java program to find the inverse of a square matrix. Let the user enter the size of the matrix up to size 21,

Write a Java program to find the inverse of a square matrix. Let the user enter the size of the matrix up to size 21, and enter the matrix values from the keyboard. Check to make sure if the matrix is singular. Output the original matrix and its inverse. Finally, ask the user if he/she wishes to run the program again. Error check input and format the output. Use a method calculate the inverse. Refer to the sample output below.

Sample Run:

Enter the size of the Matrix (<=21) : 3

Enter the matrix values: 1 4 2 2 5 8 2 1 8

Original matrix:

1 4 2

2 5 8

2 1 8

Inverse matrix:

2 -1.875 1.375

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!