Both
a and
b are four-digit numbers and one is obtained from
the other by reversing the digits.
Determine them, knowing that
2 * (a + b) = 5 * (b - 1).
Show your reasoning.
FOR a1 = 1 TO 9
FOR a2 = 0 TO 9
FOR a3 = 0 TO 9
FOR a4 = 1 TO 9
IF 2 * (1001 * (a1 + a4) + 110 * (a2 + a3)) = 5 * (1000 * a4 + 100 * a3 + 10 * a2 + a1 - 1) THEN
PRINT a1; a2; a3; a4
END IF
NEXT
NEXT
NEXT
NEXT
|
Posted by Charlie
on 2005-09-16 19:38:29 |