fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int main()
  6. {
  7. const int R = 5;
  8. int p[R];
  9.  
  10. srand(time(NULL));
  11. for (int i = 0; i < R; i++)
  12. {
  13. p[i] = rand()%(50+50)-50;
  14. printf("%d ",p[i]);
  15. }
  16.  
  17. int max = p[0];
  18. int min = p[0];
  19.  
  20. for (int i = 0; i < R; i++)
  21. {
  22. if (max < p[i]) max = p[i];
  23. if (min > p[i]) min = p[i];
  24. }
  25. printf("\n");
  26. printf("Maximum pola je :%d \n",max);
  27. printf("Minimum pola je :%d ",min);
  28. }
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
49 -31 -38 -15 -6 
Maximum pola je :49 
Minimum pola je :-38