Code :
#include<iostream>
#include<conio.h>
using namespace std;
int main() {
int i, number, sum=0;
cout<<"Enter the limit : ";
cin>>number;
for(i=1; i<=number; i++) {
sum = sum + i;
}
cout<<"Sum of given series : "<<sum;
return 0;
}
Output :
IDE Used To Test This Code : DEV C++.
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.
#include<iostream>
#include<conio.h>
using namespace std;
int main() {
int i, number, sum=0;
cout<<"Enter the limit : ";
cin>>number;
for(i=1; i<=number; i++) {
sum = sum + i;
}
cout<<"Sum of given series : "<<sum;
return 0;
}
Output :
IDE Used To Test This Code : DEV C++.
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.
Post a Comment