Hey guys, I have a huge question. I have to write a program that uses negative numbers in a conjecture algorithm. The program terminates when a number is reached that was already outputted. I can not get it to work and I have been racking my brain for a week. Any help would be wonderful Thanks!
Have you run it in a debugger, to see what's happening? Or even put in any debugging output?
From looking at it, once your first loop exits at line 19, the value of i will be set to 1000, and never changes. Every time you access x[i], you're accessing x[1000], which is past the end of the array and could contain anything.