Created
April 26, 2012 15:16
-
-
Save wakhub/2500301 to your computer and use it in GitHub Desktop.
C and konoha fibonacci
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> | |
int fib(int n) { | |
if (n <= 1) { | |
return n; | |
} | |
return fib(n - 1) + fib(n - 2); | |
} | |
int main(){ | |
int i; | |
for (i = 0; i < 20; i++) { | |
printf("%d\n", fib(i)); | |
} | |
} |
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
int fib(int n) { | |
if (n <= 1) { | |
return n; | |
} | |
return fib(n - 1) + fib(n - 2); | |
} | |
for (i = 0; i < 20; i++) { | |
print fib(i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://konoha.sourceforge.jp/