C_Algorithms 2.0.0
Documentation
Loading...
Searching...
No Matches
recursiveFib.c
Go to the documentation of this file.
1// Recursive function to calculate the fibonacci row
2
3#include <stdio.h>
4
5#include "recursiveFib.h"
6
13int RecFib(int n)
14{
15 if(n <= 2)
16 return 1;
17 return RecFib(n - 1) + RecFib(n - 2);
18}
19
25void RecursiveFib(int number)
26{
27 printf("%d\n", RecFib(number));
28}
void RecursiveFib(int number)
Prints the return value of the called function RecFib.
int RecFib(int n)
RecFib is a function wihich can calculate the fibonacci number by calling it self n times.