In sudo-code write a program that takes an integer called N and prints out the Fibonacci sequence to the Nth digit.
Anonymous
First I'd clarify the exact definition of the sequence (whether you consider the first number to be 0 or 1). You may need to adjust N by 1 before calling the program. int Fib(int N) { int prevprev = 0; int prev = 1; for (int i = 0; i < N; i++) {print prevprev; int cur = prevprev + prev; prevprev = prev; prev = cur; }}
Check out your Company Bowl for anonymous work chats.