I ran across a little puzzle today and couldn't figure it out (What else is new?). It seemed a logical thing for a computer to do. And I still couldn't get the answer. (Was a little trick to the answer, one of the numbers had a leading zero.)
And you can't easily format a leading zero in a 2 digit number.
Just for fun, here's the puzzle:
'
===========================================
"Half this game is ninety percent mental."
Yogi Berra
===========================================
And you can't easily format a leading zero in a 2 digit number.
Just for fun, here's the puzzle:
'
Code:
#Compile Exe #Include "WIN32API.INC" Function PBMain 'Need to open the safe. 'The combination is three 2-digit numbers which 'can be expressed like this: 'The total of the three numbers is 39. 'The second number Is half Of the third number. 'The first number Is the third number minus 1. Local m0$, m2$, i1&, i2&, i3& m0$ = "No Answer" ' For I3 = 20 To 99 '<< No answer here so: For I3 = 1 To 99 'try all combos i1 = i3 - 1 'The first number Is the third number minus 1. i2 = i3 / 2 'The second number Is half Of the third number. If I3 + I2 + I1 = 39 Then 'The total of the three numbers is 39. m0$ = Using$("## ## ## is the wrong answer ", i1, i2, i3) & $CrLf & _ Using$("## *0# ## is the wrong answer ", i1, i2, i3) m2$ = "00 00 00 is the right answer " Mid$(m2$, 1, 2) = Right$("0" & Trim$(Str$(i1)), 2) Mid$(m2$, 4, 2) = Right$("0" & Trim$(Str$(i2)), 2) Mid$(m2$, 7, 2) = Right$("0" & Trim$(Str$(i3)), 2) Exit For End If Next ctr ? m0$,, m2$ End Function '
"Half this game is ninety percent mental."
Yogi Berra
===========================================
Comment