Tolu went to the shop to buy some snacks for his friends.
He bought 3 packs of biscuits and 2 bottles of juice, then paid ₦1000 at the counter.
Store the price of one pack of biscuits in a variable called price_of_biscuits
and set it to 150
.
Store the price of one bottle of juice in a variable called price_of_juice
and set it to 250
.
Store the number of biscuit packs bought in a variable called packs_of_biscuits
and set it to 3
.
Store the number of juice bottles bought in a variable called bottles_of_juice
and set it to 2
.
Store the amount paid in a variable called amount_paid
and set it to 1000
.
Calculate the total cost by multiplying the number of biscuits by the price of each, multiplying the number of juices by the price of each, and then adding the two results.
Calculate the change by subtracting the total cost from the amount paid.
Print the total cost and the change.
We’re always looking for international STEM educators to join our team. If you are interested, please send us a mail and we’ll get back to you!
If you have any questions, kindly send us a mail. Don’t forget to follow and like all our social accounts to get updates on competitions!