Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- #include<conio.h>
- void main()
- {
- int n, i, sum=0, j;
- clrscr();
- cout<<"1+2+4+7+11+16+--------+n"<<endl;
- cin>>n;
- j=1;
- for(i=0; i<=n; i=i+j)
- {
- sum=sum+i;
- j++;
- }
- cout<<"Total of the series="<<sum<<endl;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment