CLS
OPEN "input.dat" FOR INPUT AS #1
INPUT #1, n
DIM a(n), b(n)
FOR i = 1 TO n
INPUT #1, a(i)
b(i) = i
NEXT
CLOSE
FOR i = 1 TO n
FOR j = 2 TO n
IF a(j) > a(j - 1) THEN SWAP a(j), a(j - 1): SWAP b(j), b(j - 1)
NEXT
NEXT
OPEN "output.dat" FOR OUTPUT AS #2
FOR i = 1 TO n
PRINT #2, b(i)
NEXT
CLOSE
Тестирование выполнено в программе QB64 ( Скачать )