Welcome to the World of Online Learning:
Hello Friends “This blog helps you to learn C++ programming concepts. You can learn C++ language at your own speed and time. One can learn concepts of C++ language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Write a C++ program to Find Sum of Natural Numbers using Recursion
PROGRAM:C++ program to Find Sum of Natural Numbers using Recursion
/* C++ program to Find 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;
}