Created
December 3, 2012 19:19
-
-
Save nealg223/4197252 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
unsigned int fib(unsigned int n) { | |
unsigned int a = 1, b = 1; | |
unsigned int tmp; | |
while (--n >= 0) { | |
tmp = a; | |
a += b; | |
b = tmp; | |
} | |
return a; | |
} | |
main() { | |
printf("%u", fib(10)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment