fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int a[5] ={1, 3, 5, 2, -1};
  6. int min, max;
  7. int i;
  8.  
  9. min = max = a[0];
  10. for (i = 1; i < 5; i++) {
  11. if (a[i] < min) min = a[i];
  12. if (max < a[i]) max = a[i];
  13. }
  14. printf("min=%d max=%d\n", min, max);
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0.02s 1720KB
stdin
Standard input is empty
stdout
min=-1 max=5