MCPcopy Create free account
hub / github.com/Rustam-Z/cpp-programming / fibonacci

Function fibonacci

Lab_07/fibonacci.cpp:5–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3using namespace std;
4
5int fibonacci(int num)
6{ // new function 'fibonacci' for calculating fibonacci series
7 if (num <= 1)
8 {
9 return num;
10 }
11 else
12 {
13 return (fibonacci(num - 1) + fibonacci(num - 2));
14 }
15}
16int main()
17{
18 cout << "\t\t\t***Program to calculate the sum of natural numbers using recursion***" << endl;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected