fork download
  1. #include <stdio.h>
  2. #include <float.h>
  3. #include <math.h>
  4.  
  5. static void test_scanf(const char *s)
  6. {
  7. double x1, x2;
  8.  
  9. if ((sscanf(s, "%lf %lf", &x1, &x2)) == 2)
  10. {
  11. printf("%s: %e, %e (exponential form)\n", s, x1, x2);
  12. printf(" %g %g\n", x1, x2);
  13. printf(" %.7g %.7g\n", x1, x2);
  14. }
  15. else
  16. {
  17. printf("%s: invalid input.\n", s);
  18. }
  19. }
  20.  
  21. int main(void)
  22. {
  23. test_scanf("6369.015 66159.129");
  24. }
  25.  
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
6369.015 66159.129: 6.369015e+03, 6.615913e+04 (exponential form)
    6369.02 66159.1
    6369.015 66159.13