Wednesday, 27 June 2012

c++ program to generate series : 0 1 3 6 10 ….n terms.

#include <iostream>
using namespace std;
int main()
{
int a,i,j;
int num;
cout<<"Enter the no:";
cin>>a;
num=0;
j=1;



cout<<"result series is:  ";
for(i=0;i<a;i++)
{
cout<<num<<"   ";
num=num+j;
j=j+1;
}
return 0;
}