Programming Code Center(PCC)
[CPP]

(PCC)::[How-to-write-CPP-program-to-Find-Sum-of-Natural-Numbers-using-Recursion]::[cpp]

File Name : Sum_of_Natural_Numbers_using_Recursion.cpp

//Example: Calculate Sum of Natural numbers using Recursion
#include<iostream>
using namespace std;

int add(int n);

int main()
{
    int n;

    cout << "Enter a positive integer: ";
    cin >> n;

    cout << "Sum =  " << add(n);

    return 0;
}

int add(int n)
{
    if(n != 0)
        return n + add(n - 1);
    return 0;
}

Output :

Sum_of_Natural_Numbers_using_Recursion.jpg