' ' Culture ' Problem 1, AIC 2003 ' Visual Basic Sample Solution ' Sub Main() Dim total As Long Dim start As Long Dim days As Long ' Open the I/O files. Open "cultin.txt" For Input As #1 Open "cultout.txt" For Output As #2 ' Read in the total number of bacteria. Input #1, total ' Assume the experiment has been running for 0 days. start = total days = 0 ' While the initial number of bacteria is still even, halve this ' initial number and add one day to the experiment. While start Mod 2 = 0 start = start / 2 days = days + 1 Wend ' Now the initial number of bacteria is odd, so we must have our solution. Print #2, Str$(start) + " " + Str$(days) ' Tidy up. Close #1 Close #2 End Sub