Why? That shows the problem with the posted code. The code must not be following the algorithm. The code as posted will not work.
What will the value of j be when the for loop ends?
Type: Posts; User: Norm
Why? That shows the problem with the posted code. The code must not be following the algorithm. The code as posted will not work.
What will the value of j be when the for loop ends?
Look at the algorithm and see if the code is following it.
If you removed the isolated definitions for i,j,k how does the code compile without an error?
Remove the isolated, separate definitions for i,j,k
Define them in the for loops:
for(int i = 0; ....)
same for j and k
Look at how row and col were defined at the top of the method.
What happens now?
I see that i,j,k are still defined outside the for loops. Why is that?
That's a runtime exception, not a compiler error.
At line 2387 the index to an array went past the end of the array.
Remember that the range of indexes for an array is from 0 to the array...
Please copy the full text of the error messages and paste it here.
Please edit your post and wrap your code with
<YOUR CODE HERE>
to get highlighting and preserve formatting.
You need to find the algorithm to be able to write the code.
Without an algorithm for how to invert a matrix, you can not write a program to do it.
How will you know if the matrix has been correctly inverted if you can not describe what an inverted matrix is?
What is the algorithm for inverting a matrix? Can you post the details of what is done and give an example of a matrix before and after?