Here I have given C++ program to discover aggregate of first n common numbers. As a matter of first importance, I am perusing estimation of n and afterwards figuring the aggregate utilizing for circle.
On the off chance that you have any questions identified with the program, at that point don’t hesitate to ask in the remark area.
C++ Program to Find Sum of First n Natural Numbers
#include<iostream>
using namespace std;
int main()
{
int i,n,sum=0;
cout<<"How many numbers? ";
cin>>n;
for(i=1;i<=n;++i)
{
sum+=i;
}
cout<<"Sum="<<sum;
return 0;
}
Output
How many numbers? 5
Sum=15