CLS
OPTION BASE 1
INPUT "M=", m
INPUT "N=", n
DIM x(m, n) AS STRING
FOR i = 1 TO m
FOR j = 1 TO n
PRINT "x("; i; ", "; j; ")= ";
INPUT "", x(i, j)
NEXT j
NEXT i
INPUT "I=", i
INPUT "K=", k
IF i <= m AND i <= n AND k <= m AND k <= n THEN
DIM tmp AS STRING
tmp = x(i, k)
x(i, k) = x(k, i)
x(k, i) = tmp
FOR i = 1 TO m
FOR j = 1 TO n
PRINT "("; i; ","; j; ")="; x(i, j);
PRINT ""
NEXT j
NEXT i
ELSE
PRINT "Incorrect params"
END IF
PRINT ""
IF m = n THEN
PRINT "Main diagonal:"
FOR d = 1 TO m
PRINT x(d, d); ",";
NEXT d
ELSE
PRINT "Matrix is not square. Main diagonal is null";
END IF