Skip to content

Instantly share code, notes, and snippets.

@rsayers
Created January 16, 2010 21:53
Show Gist options
  • Save rsayers/279037 to your computer and use it in GitHub Desktop.
Save rsayers/279037 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