13 14 15 16
12 11 10 9
5 6 7 8
4 3 2 1
INPUT "vvedite razmer massiva ", n
DIM a(n, n)
FOR i = n TO 1 STEP -1
IF i MOD 2 = n MOD 2 THEN FOR j = n TO 1 STEP -1: k = k + 1: a(i, j) = k: NEXT ELSE FOR j = 1 TO n: k = k + 1: a(i, j) = k: NEXT
NEXT
PRINT "massiv"
FOR i = 1 TO n
FOR j = 1 TO n
PRINT a(i, j);
NEXT
PRINT
NEXT
Тестирование выполнено в программе QB64 ( Скачать )