C++ program to find sum of series 1 + 2 + 3 +……+ n

C++ program to find sum of series 1 + 2 + 3 +......+ n

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int i,n,sum=0;
cout<<“1+2+3+……+n”;
cout<<“nEnter the value of n:”;
cin>>n;

for(i=1;i<=n;++i)
sum+=i;
cout<<“nSum=”<<sum;
getch();
}

2 thoughts on “C++ program to find sum of series 1 + 2 + 3 +……+ n

  1. muskaan dhasmana

    program in c++ to find sum of series sum=1+(1+2)+(1+2+3)+……………..n

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *