Quote:
I tried to debug it but I can't tell what s the problem.
Looks like you need to sharpen your Debug-Fu.
If you use the debugger correctly, you can't be in this situation.
Quote:
I wrote the program below but when I run it, the program return the same values.
You know that the same value every time is wrong, you know how the result is built, you know which values should change between runs and the reason.
With the debugger, check all those values, when something do not behave as expected, investigate what is wrong in the way it is built ...