Skip to content

Instantly share code, notes, and snippets.

@mumumu
Created January 30, 2011 14:52
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 mumumu/802911 to your computer and use it in GitHub Desktop.
Save mumumu/802911 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
static unsigned int fib(unsigned int param)
{
if (param < 0) {
return 0;
}
if (param == 1 || param == 2) {
return 1;
}
return fib(param - 1) + fib(param - 2);
}
int main(int argc, char *argv[])
{
// No Error Processing
printf("%d", fib(atoi(argv[1])));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment