The print statement is irrelevant. It was included in case the code was compiled and run to see the output.

The point I was trying to make is that your loop is pointless only the last value is retained. When i is 1, perform calculation, assign to det. Then i is 2, perform calculation, assign to det, throw away first result. Then i is 3, perform calculation, assign to det, throw away second result, etc. Your loop can be replaced with: