Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  4.  
  5. int main( )
  6. {
  7. int i,sum=0;
  8. int n;
  9. scanf("%d",i);
  10. for(int j=0;j<=i;j++)
  11. {
  12. if(j=2*n)
  13. j=j*(-1);
  14. else
  15. j=j*1;
  16. sum+=j;
  17. }
  18. printf("%d \n",sum);
  19. getchar();
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement