Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main( )
- {
- int i,sum=0;
- int n;
- scanf("%d",i);
- for(int j=0;j<=i;j++)
- {
- if(j=2*n)
- j=j*(-1);
- else
- j=j*1;
- sum+=j;
- }
- printf("%d \n",sum);
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement