PDA

View Full Version : Programming Puzzle 13 - Paycheck Amount?

ABC123

Tom Cone Jr
06-28-2011, 05:00 PM
Mr. Karbunkle went to the bank to cash his weekly paycheck. In handing over the money, the cashier, by mistake, gave him dollars for cents and cents for dollars.

He pocketed the money without examining it and spent a nickel on candy for his little boy. He then discovered the error and found he possessed exactly twice the amount of the check.

If he had no money in his pocket before cashing the check, what was the exact amount of the check? One clue: Mr. Karbunkle earns less than \$50 a week.

(Courtesy: Creative Computing Magazine)

Instructions:

Write an xbasic script that solves the puzzle and displays the answer in a message box on screen.

aschone
06-28-2011, 11:38 PM
Hrm.. Sounds like I might want to start banking at Mr. Karbunkle's bank.

Tom Cone Jr
06-29-2011, 09:33 AM
I took a different approach using brute force to test all the possible amounts that might have been given to Karbunkle by the cashier.

jeb richardson
08-12-2011, 03:27 PM
Here is my attempt for puz 13.

29054