CLS
u$ = "0123456789ABCDEF"
DO
INPUT "vvedite p"; p
LOOP UNTIL p >= 2 AND p <= 16
FOR j = 1 TO p
IF j = 1 THEN PRINT SPACE$(2); CHR$(179);
PRINT MID$(u$, j, 1); SPACE$(3);
NEXT
PRINT: PRINT STRING$(p * 4, 196)
FOR i = 1 TO p
PRINT MID$(u$, i, 1); SPACE$(1); CHR$(179);
FOR j = 1 TO p
b = i + j - 2: c$ = ""
DO
c$ = MID$(u$, (b MOD p) + 1, 1) + c$: b = b \ p
LOOP UNTIL b = 0
PRINT c$; SPACE$(4 - LEN(c$));
NEXT: PRINT: NEXT
Тестирование выполнено в программе QB64 ( Скачать )