求实数的绝对值.c 235 B

1234567891011121314151617
  1. #include <stdio.h>
  2. int main() {
  3. double input;
  4. scanf("%lf", &input);
  5. double output;
  6. if (input < 0) {
  7. output = -input;
  8. } else {
  9. output = input;
  10. }
  11. printf("%.2f\n", output);
  12. return 0;
  13. }