|
zadach127.BAS |
|
{* Задача127 *}REM basic ' Написать сумму трех максимальных элементов массива.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)
End
|