fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a = 0, b = 0;
  5. scanf("%d", &a);
  6. //a = (a < 0) ? -a : a;
  7.  
  8. while (a) {
  9. b = b * 10 + (a % 10);
  10. a /= 10;
  11. }
  12.  
  13. printf("%d\n", b);
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 2160KB
stdin
-123
stdout
-321