| 11 | } |
| 12 | |
| 13 | int main2() |
| 14 | { |
| 15 | cout << "\t\t\t***Program to calculate the sum of natural numbers using recursion***" << endl; |
| 16 | int num; |
| 17 | cout << "Please enter the interval: "; |
| 18 | cin >> num; // inpuing the interval of the numbers |
| 19 | cout << "The sum is : " << sum(num); // calling function 'sum' |
| 20 | return 0; |
| 21 | } |