INPUT "vvedite kol-vo elementov ", n
DIM a(n)
RANDOMIZE TIMER
PRINT "ishodnyj massiv"
FOR i = 1 TO n
a(i) = INT(RND * 100)
PRINT a(i);
NEXT
PRINT
min = a(1)
max = a(1)
FOR i = 1 TO n
IF a(i) > max THEN max = a(i)
IF a(i) < min THEN min = a(i)
NEXT
a(1) = max
a(n) = min
PRINT "novyj massiv"
FOR i = 1 TO n
PRINT a(i);
NEXT
Тестирование выполнено в программе QB64 ( Скачать )