Created
January 30, 2011 14:52
-
-
Save mumumu/802911 to your computer and use it in GitHub Desktop.
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 <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