CLS
RANDOMIZE TIMER
INPUT "Vvedite kol-vo elementov: ", n
DIM A(n) AS INTEGER
FOR i = 1 TO n
A(i) = RND * 51
PRINT A(i)
NEXT
FOR j = 1 TO 3: FOR i = n - 1 TO 1 STEP -1
IF A(i) < A(i + 1) THEN SWAP A(i), A(i + 1)
NEXT i, j
PRINT "Summa treh maksymalnyh elementov: "; A(1) + A(2) + A(3)
Тестирование выполнено в программе QB64 ( Скачать )