'Microsoft QBASIC CLS FOR a = 1 TO 9 FOR b = 0 TO 9 FOR c = 0 TO 9 FOR d = 1 TO 9 n1 = 1000 * a + 100 * b + 10 * c + d n2 = 10 * a + c n3 = 10 * d + b IF n1 = n2 * n3 * 4 THEN PRINT a; b; c; d; " = "; a; c; " * "; d; b; " * 4" END IF NEXT d NEXT c NEXT b NEXT a
CLS
FOR a = 1 TO 9
FOR b = 0 TO 9
FOR c = 0 TO 9
FOR d = 1 TO 9
n1 = 1000 * a + 100 * b + 10 * c + d
n2 = 10 * a + c
n3 = 10 * d + b
IF n1 = n2 * n3 * 4 THEN
PRINT a; b; c; d; " = "; a; c; " * "; d; b; " * 4"
END IF
NEXT d
NEXT c
NEXT b
NEXT a
Результат выполнения программы:
1 9 7 2 = 1 7 * 2 9 * 4
5 4 7 2 = 5 7 * 2 4 * 4
8 6 3 2 = 8 3 * 2 6 * 4