I am a three digit number.
I am either divisible by 3 or by 5.
I am either divisible by 4 or by 6.
I am either divisible by 5 or by 7.
I am either divisible by 6 or by 8.
I am either divisible by 7 or by 9.
I am either divisible by 9 or by 11.
What am I?
(Note: "divisible" means leaving no remainder.)
All these fit the bill:
126
180
252
270
360
378
450
462
504
540
630
720
756
810
882
900
924
990
since "or" does not exclude the possibility of both parts being true.
FOR n = 100 TO 999
IF n MOD 3 = 0 OR n MOD 5 = 0 THEN
IF n MOD 4 = 0 OR n MOD 6 = 0 THEN
IF n MOD 5 = 0 OR n MOD 7 = 0 THEN
IF n MOD 6 = 0 OR n MOD 8 = 0 THEN
IF n MOD 7 = 0 OR n MOD 9 = 0 THEN
IF n MOD 9 = 0 OR n MOD 11 = 0 THEN
PRINT n
END IF
END IF
END IF
END IF
END IF
END IF
NEXT
|
Posted by Charlie
on 2006-05-13 12:22:48 |