CLS
RANDOMIZE TIMER
INPUT "vvedite n"; n
DIM a(n)
FOR i = 1 TO n
a(i) = FIX(RND * 90 + 10)
NEXT
PRINT "massiv"
FOR i = 1 TO n
PRINT a(i);
NEXT
max = a(1): min = a(1)
FOR i = 1 TO n
IF a(i) > max THEN max = a(i): k1 = i
IF a(i) < min THEN min = a(i): k2 = i
NEXT
SWAP a(k1), a(k2)
PRINT
PRINT "min ="; min, "max ="; max
PRINT "new massiv"
FOR i = 1 TO n
PRINT a(i);
NEXT
END
Тестирование выполнено в программе QB64 ( Скачать )