Skip to content

Instantly share code, notes, and snippets.

@croach
Created January 16, 2010 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save croach/278566 to your computer and use it in GitHub Desktop.
Save croach/278566 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int fib(n) {
if ((n == 0)||(n == 1)) {
return n;
} else {
return fib(n-1) + fib(n-2);
}
}
int main (int argc, char const *argv[])
{
int i;
for (i = 0; i < 36; i++) {
printf("n = %d => %d\n", i, fib(i));
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment