Created
January 25, 2018 06:42
-
-
Save south37/5ff35f1e09e387d34a9a991e7050bb87 to your computer and use it in GitHub Desktop.
fib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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