Skip to content

Instantly share code, notes, and snippets.

@koduki
Created February 14, 2009 17:35
Show Gist options
  • Save koduki/64418 to your computer and use it in GitHub Desktop.
Save koduki/64418 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
int fib(int n){
// if (n > 100 ) return 1;
return
(n == 0) ? 0
:(n == 1) ? 1
: fib(n-1) + fib(n-2);
}
int main(int argc, char *argv[]){
printf("%d\n", fib(atoi(argv[1])));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment