fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <limits.h>
  4.  
  5. void is_the_absolute_value_nonnegative(int x){
  6. int abs_x = abs(x);
  7. printf("abs(%d) = %d, %s\n", x, abs_x, abs_x>=0?"non-negative":"negative");
  8. }
  9.  
  10. int main(void) {
  11. is_the_absolute_value_nonnegative(-10);
  12. is_the_absolute_value_nonnegative(0);
  13. is_the_absolute_value_nonnegative(10);
  14. is_the_absolute_value_nonnegative(INT_MAX);
  15. is_the_absolute_value_nonnegative(INT_MIN);
  16. return 0;
  17. }
Success #stdin #stdout 0s 4480KB
stdin
Standard input is empty
stdout
abs(-10) = 10, non-negative
abs(0) = 0, non-negative
abs(10) = 10, non-negative
abs(2147483647) = 2147483647, non-negative
abs(-2147483648) = -2147483648, non-negative