fork download
  1. #include <stdio.h>
  2. #include <limits.h>
  3. #include <inttypes.h>
  4.  
  5. int main(void) {
  6. uint32_t x;
  7. for(; scanf("%"PRIi32,&x) > 0;
  8. printf("%"PRIi32"\n",
  9. (x )*( ( ( x / (1 << 31) ) + 1 ) % 2 ) +
  10. (-x)*( ( ( x / (1 << 31) ) ) % 2 ) )
  11. );
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 1836KB
stdin
1
46
2
-5
10
-1488
-666
42
11
-54
-9
-5
555
-444
5465
-3
-354
465
3581
-68
777
-1
0
-0
-854
stdout
1
46
2
5
10
1488
666
42
11
54
9
5
555
444
5465
3
354
465
3581
68
777
1
0
0
854