fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int mass[] = {2, 2, -3, 1, 5};
  5. int N = sizeof (mass) / sizeof (int);
  6. double min = mass[0], max = mass[0], pr = 1;
  7. //for(int i = 0 ; i<N ; i++)
  8. // scanf (&mass[i]);
  9. for(int i = 0 ; i<N ; i++) {
  10. printf ("%d, ", mass[i]);
  11. if (min > mass[i])
  12. min = mass[i];
  13. if (max < mass[i])
  14. max = mass[i];
  15. }
  16. printf ("\n");
  17. min = min / 2;
  18. max = max / 2;
  19. for (int i = 0; i < N; i++) {
  20. if (mass[i] >= min && mass[i] <= max) {
  21. pr = pr * mass[i];
  22. }
  23. }
  24.  
  25. mass[0] = pr;
  26. mass[N-2] = pr;
  27.  
  28. for(int i = 0 ; i<N ; i++) {
  29. printf ("%d, ", mass[i]);
  30. }
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 2168KB
stdin
Standard input is empty
stdout
2, 2, -3, 1, 5, 
4, 2, -3, 4, 5,