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