fork download
  1. #include <stdio.h>
  2. #include <stdarg.h>
  3. #include <float.h>
  4.  
  5. double max(int count, ...)
  6. {
  7. double max = -DBL_MAX, test;
  8.  
  9. va_list values;
  10. va_start(values, count);https://i...content-available-to-author-only...e.com/OfpjUi#
  11. for(int i = 0; i < count; ++i)
  12. {
  13. test = va_arg(values, double);
  14. if(test > max)
  15. {
  16. max = test;
  17. }
  18. }
  19. va_end(values);
  20. return max;
  21. }
  22.  
  23. int main()
  24. {
  25. printf("%lf", max(5,1.0,6.0,-31.0,23.0,24.0));
  26. return 0;
  27. }
Success #stdin #stdout 0s 5384KB
stdin
Standard input is empty
stdout
24.000000