I (surprisingly) could not get it to generate a Fibonacci function that skips 5.
So starting with 1 and 1, we get 2. 2 and 1 is three. 3 and 2 is five. What do we do from here? Do I not add 5 and 3? If not, then what do I add? 3 and 2 again? Do I repeat 3 and get 6? What does it mean to “skip 5”?
// Print the fibonnaci sequence, except the number 5.
int main() {
I got the result: int a = 0;
int b = 1;
int c = 0;
while (c < 100) {
c = a + b;
a = b;
b = c;
if (c != 5) {
cout << c << endl;
}
}
return 0;