Wednesday, 27 June 2012

c++ program to generate series : 2 3 5 7 10 14 ….n terms.


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


cout<<"result series is:  ";
for(i=0;i<a;i++)
{
num=num+(i*i);

cout<<num<<"   ";


}

return 0;
}