Posted by Sascha Peilicke on Mon 19 Oct 12:58
report abuse | download | new post
- int fib(unsigned int n)
- {
- if (n == 0) {
- return 0;
- } else if (n == 1) {
- return 1;
- } else {
- return fib(n - 1) + fib(n -2);
- }
- }
- int main(void)
- {
- fib(5);
- fib(20);
- return 0;
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.