Puzzles and Problems

Beginning Xbasic Programming

Puzzle 3 - Fractions, anyone?

The "fraction monster" has taken over your machine. He's had it up to here

with loops, so no loops are allowed. Here's the puzzle, courtesy

of Creative Computing Magazine:

Mrs. Canton wanted to buy all the grocer's apples for a church picnic.

When she asked how many apples the store had, the grocer replied:

"If you added 1/4, 1/5, and 1/6 of them, that would make 37. After

giving the grocer a look that would melt steel, Mrs. Canton pulled

out her new netbook computer and figured it out. Can you? How

many apples were in the store?

Instructions:

Most of us with a pencil and paper (and a big eraser!) could figure this

out by hand (eventually). Your instructions however are these:

Write an xbasic script that solves the puzzle and then display both

your solution and its "proof", in a single message box. Your

"proof" will be accepted if we can see how much 1/4, 1/5 and 1/6

of your answer are, and that their sum is 37.

Tip: This will involve writing a multi-line string to your

message box.

Have fun!

ps.For bonus pointswrite your solution and its "proof" to the

trace window. Don't know about the trace window yet? It's

time to learn. The trace window is your friend.

## Bookmarks