coconut challenge solution
- Posted by quantum_analyst at hotmail.com Dec 16, 2001
- 457 views
-- Does exactly the same but uses while loops like asked integer num atom coconuts num = 1 while 1 do coconuts = ((((3 * (num) + 1) / 2 * 3 + 1) / 2 * 3 + 1) / 2 * 3 + 1) if coconuts = floor(coconuts) then exit else num += 1 end if end while printf(1, "The number of coconuts they collected is %d.", coconuts)