Дан массив R из N элементов. Исключить максимальный и минимальный элементы — Basic(Бейсик)

INPUT n
DIM R(n)
FOR i = 1 TO n
INPUT R(i)
NEXT
min = R(1)
max = R(1)
FOR i = 1 TO n
IF R(i) < min THEN min = R(i): Nmin = i
IF R(i) > max THEN max = R(i): Nmax = i
NEXT
PRINT "chislo elementov="; n
PRINT "Ishodniy massiv"
FOR i = 1 TO n
PRINT R(i); " ";
NEXT
PRINT
PRINT "max="; max
PRINT "min="; min
FOR i = 1 TO n
IF i <> Nmin AND i <> Nmax THEN k = k + 1: R(k) = R(i)
NEXT
PRINT "noviy massiv"
FOR i = 1 TO n - 2
PRINT R(i); " ";
NEXT

Leave a Comment