Shortened & removed possible errors

1. Shortened the input of the matrices by using for loops. (This also enables the use of larger matrices).
2. The program now checks to see if detA = 0, if it does then stop the program as it will cause an error, otherwise continue.