Develop a program to find inverse of a square matrix. Program should accept the input matrix via a file. The name of the file should be accepted as an input from console. The file format from which to read the elements of the matrix is described below. A valid input consists of only numbers. In case of a bad input, program should output appropriate message as mentioned in output specification below.
Input Format:
Line 1
Absolute path of the first input file
Note:
Input in file column in table below is provided to help you visualize how the input file will look like. Your program should only accept name of the file as input.
Output
Print Inverse of the input matrix rounded up to 3 digits after decimal point, on console in the format shown in table below
Sample Input and Output
SNo. Input Input in file Output(Rounded upto Three Decimal digits)
1
input.txt
1 1 1
1 1 1
1 1 1
Matrix is singular. Cannot find inverse.
2
input.txt
A b
c d
Invalid Input
3
input.txt
15 18 56
85 96 32
45 63 65
Inverted Matrix :
0.088 0.049 -.0100
-0.085 -0.032 0.090
0.022 -0.003 -0.002
4
input.txt
4 5 6 7
4 5 6 6
4 5 6 6
Matrix inverse can be calculated only for a square matrix.