#include <iostream>
using namespace std;
int main(){
int n , sum =0;
cout<<"enter the value of n:"<<endl;
cin>>n;
for(int i = 1; i<=n; i++){
sum+= i;
}
cout<<"sum of natural numbers."<<endl;
cout<<sum<<endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: