Примеры программ на языке QBASIC

DECLARE SUB ADDMAT (A%(), B%(), C%(), N%)
DEFINT A-Z
CLS
DIM A1(2, 2), A2(2, 2), A3(2, 2)
DIM B1(3, 3), B2(3, 3), B3(3, 3)
FOR J = 0 TO 2: FOR K = 0 TO 2
  A1(J, K) = J + K: A2(J, K) = J * K
NEXT K: NEXT J
CALL ADDMAT(A1(), A2(), A3(), 2): ' Так можно обратиться к подпрограмме
FOR J = 0 TO 3: FOR K = 0 TO 3
  B1(J, K) = J + K: B2(J, K) = J * K
NEXT K: NEXT J
ADDMAT B1(), B2(), B3(), 3:    ' И так можно обратиться к подпрограмме
FOR J = 0 TO 2: FOR K = 0 TO 2
  PRINT A1(J, K); "+"; A2(J, K); "="; A3(J, K),
NEXT K: PRINT : NEXT J: PRINT
FOR J = 0 TO 3: FOR K = 0 TO 3
  PRINT B1(J, K); "+"; B2(J, K); "="; B3(J, K),
NEXT K: PRINT : NEXT J

END

SUB ADDMAT (A%(), B%(), C%(), N%)
DEFINT A-Z
FOR Q = 0 TO N: FOR S = 0 TO N
  C(Q, S) = A(Q, S) + B(Q, S)
NEXT S: NEXT Q
END SUB