I am trying to print a Fibonacci sequence using a do-while
loop in java and can't understand this. Needs to be between 0 and 100.
I have the following code:
int prevPrevVal = 0;
int prevVal = 1;
int currVal;
System.out.println(prevPrevVal);
System.out.println(prevVal);
do
{
currVal = prevVal + prevPrevVal;
System.out.println(currVal);
prevPrevVal = prevVal;
prevVal = currVal;
} while (prevVal <= 100);