HomeC++

C++ program to Find Sum of Natural Numbers

C++ program to Find Sum of Natural Numbers

we make Some Program in C++ program to Find Sum of Natural Numbers using Recursion.Lets Try To make it.

C++ program to Find Sum of Natural Numbers

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int i,n,sum=0;
cout<<"Enter Any Numbers : ";
cin>>n;
for(i=1;i<=n;++i)
{
sum+=i;
}
cout<<"Sum="<<sum;
return 0;
}

Output of ProgramC++ program to Find Sum of Natural Numbers using Recursion

Comments (0)

Leave a Reply