Skip to content

Instantly share code, notes, and snippets.

@south37
Created January 25, 2018 06:42
Show Gist options
  • Save south37/5ff35f1e09e387d34a9a991e7050bb87 to your computer and use it in GitHub Desktop.
Save south37/5ff35f1e09e387d34a9a991e7050bb87 to your computer and use it in GitHub Desktop.
fib
#include "stdlib.h"
#include "stdio.h"
int fib(int n) {
if (n == 0 || n == 1) {
return 1;
} else {
return fib(n - 1) + fib(n - 2);
}
}
int main(int argc, char** argv) {
int i = atoi(argv[1]);
printf("%d\n", fib(i));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment