fork download
  1. Program Kuznetsova8;
  2. Uses Crt;
  3. Var
  4. A : array[1..15] of Integer;
  5. i, minIdx, maxIdx, temp : Integer;
  6. Begin
  7. ClrScr;
  8. Randomize;
  9. For i := 1 to 15 do
  10. Begin
  11. A[i] := Random(101);
  12. Write(A[i]:5);
  13. End;
  14. Writeln;
  15. minIdx := 1;
  16. maxIdx := 1;
  17. For i := 2 to 15 do
  18. Begin
  19. if A[i] < A[minIdx] then minIdx := i;
  20. if A[i] > A[maxIdx] then maxIdx := i;
  21. End;
  22. temp := A[minIdx];
  23. A[minIdx] := A[maxIdx];
  24. A[maxIdx] := temp;
  25. For i := 1 to 15 do
  26. Write(A[i]:5);
  27. Writeln;
  28. Readln;
  29. End.
  30.  
  31.  
  32.  
  33.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
   78   31   45   70   27   99   48   33   84   69   42   18   16    4   95
   78   31   45   70   27    4   48   33   84   69   42   18   16   99   95