INPUT "vvedite kol-vo rayonov ", n
DIM a(n), nom(n)
FOR i = 1 TO n
PRINT "rayon nomer "; i
INPUT "zapas=", a(i)
nom(i) = i
NEXT
PRINT "rayon", "zapas"
FOR i = 1 TO n
PRINT nom(i), a(i)
NEXT
FOR i = 1 TO n
FOR j = 2 TO n
IF a(j) < a(j - 1) THEN SWAP a(j), a(j - 1): SWAP nom(j), nom(j - 1)
NEXT
NEXT
PRINT " rayony s minimalnym zapasom"
PRINT "rayon", "zapas"
FOR i = 1 TO 3
PRINT nom(i), a(i)
NEXT
Тестирование выполнено в программе QB64 ( Скачать )