15 16 17 18
55 54 53 52
20 40 30 50
17 28 34 42
CLS
'- Matrica
DATA 15,16,17,18
DATA 55,54,53,52
DATA 20,40,30,50
DATA 17,28,34,42
'- Massiv
DIM A(4, 4) AS INTEGER
'- Zapolnenie
FOR iy = 1 TO 4: FOR ix = 1 TO 4
READ A(ix, iy): PRINT A(ix, iy);
NEXT ix: PRINT : NEXT iy: PRINT
'- Sortirovka
cnt = 4
FOR iy = cnt - 1 TO 1 STEP -1: FOR ix = iy TO cnt - 1
IF A(4, ix + 1) < A(4, ix) THEN
FOR i = 1 TO 4: SWAP A(i, ix + 1), A(i, ix): NEXT
END IF
NEXT ix, iy
'- Vivod
FOR iy = 1 TO 4: FOR ix = 1 TO 4
PRINT A(ix, iy);
NEXT ix: PRINT : NEXT iy
Тестирование выполнено в программе QB64 ( Скачать )