fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int n;
  6. scanf("%d", &n);
  7. int j;
  8. int tong = 0;
  9. for (j = 0; j <= n; j++);
  10. {
  11. printf("%d\n", tong);
  12. if ( j%2 == 0 ) tong -= j;
  13. else tong = tong + j;
  14. }
  15. printf("%d", tong);
  16. }
  17.  
Success #stdin #stdout 0s 4188KB
stdin
1
stdout
0
-2