| 3 | using namespace std; |
| 4 | |
| 5 | int 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 | } |
| 16 | int main() |
| 17 | { |
| 18 | cout << "\t\t\t***Program to calculate the sum of natural numbers using recursion***" << endl; |