I am asked to type a code of the Fibonacci sequence until it reaches a value less than or equal to 1 million. For those that don't know the sequence is so that you start at 1 and the next number is the 2 numbers prior added, ex... 1,1,2,3,5,8....
I have the jist of the program already BUT it doesn't never stops at the number before 1 million (which should be 832040) instead it goes either the one above 1 million or a couple numbers down from 1 million. No errors in my code just need clarification on how to make it stop at one million. Also thanks for the help but please don't suggest "easier" methods because the method I used is what I have learned so far.
int x, y, z;