Saturday, August 3, 2024

πŸ–₯ Code Challenge: Snacky Friends, a Donkey, and Apples

This program is my submission for a code challenge by "sVB" (as per this Facebook post shared with the "BASIC Programming Language" group):

Once upon a time, 3 friends bought apples and carried them on a donkey.
When night came, they decided to sleep in the forest.

The first friend woke up hungry at midnight, so he divided the apples into three equal shares.
The one extra remaining apple, he gave it to the donkey.  He then ate his share and went back to sleep.

A while later, the second friend woke up hungry, so he divided the remaining apples into three equal shares.
The one extra remaining apple, he gave it to the donkey.  He then ate his share and went back to sleep.

A while later, the third friend woke up hungry, so he divided the remaining apples into three equal shares.
The one extra remaining apple, he gave it to the donkey.  He then ate his share and went back to sleep.

In the morning, the 3 friends woke up hungry, so they divided the remaining apples into three equal shares.
The one extra remaining apple, they gave it to the donkey.  They then ate each of their share.

How many apples did they initially buy, and how many apples did each of them eat?

No comments:

Post a Comment

πŸ–₯A "10PRINT" Variant, BAMified

This program by Charlie Veniot is a port and mod of Ian Witham's C64 program found in this YouTube video. New colours are randomly proje...