CLS
RANDOMIZE TIMER
DIM A(30)
FOR i = 1 TO 30
A(i) = INT(RND * 200) - 100
NEXT i
FOR i = 1 TO 30
PRINT A(i);
NEXT i
PRINT
max = A(1): imax = 1
FOR i = 2 TO 30
IF A(i) > max THEN max = A(i): imax = i
NEXT i
k = imax + 1
IF k > 30 THEN
PRINT "Za maksimalnim elementom massiva A(30) elementov net"
ELSE
PRINT "Element massiva A(30), sled za maksimalnim="; A(k)
END IF
END
Тестирование выполнено в программе QB64 ( Скачать )