Computers and Technology

Suppose we can buy a chocolate bar from the vending machine for $1 each. Inside every chocolate bar is a coupon. We can redeem six coupons for one chocolate bar from the machine. This means that once you have started buying chocolate bars from the machine, you always have some coupons. We would like to know how many chocolate bars can be eaten if we start with N dollars and always redeem coupons if we have enough for an additional chocolate bar. For example, with 6 dollars we could consume 7 chocolate bars after purchasing 6 bars giving us 6 coupons and then redeeming the 6 coupons for one bar. This would leave us with one extra coupon. For 11 dollars, we could consume 13 chocolate bars and still have one coupon left. For 2 dollars, we could have consumed 14 chocolate bars and have two coupons left.
Write a program that inputs a value for N and outputs how many chocolate bars we can eat and how many coupons we would have left over. Use a loop that continues to redeem coupons as long as there are enough to get at least one chocolate bar.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 08:30, Calirose
When you interpret the behavior of others according to your experiences and understanding of the world your evaluation is
Answers: 1
image
Computers and Technology, 24.06.2019 00:40, iamsecond235p318rq
To maintain clarity and focus lighting might be needed
Answers: 2
image
Computers and Technology, 24.06.2019 13:50, Estefaniamarilicolin
What does code do? a creates a text box that says "solid black" b creates a black border of any width c creates a black border 1 pixel wide
Answers: 1
image
Computers and Technology, 25.06.2019 10:00, kyleryoung0602
Most common level of education for a programmer or software developer
Answers: 1
Do you know the correct answer?
Suppose we can buy a chocolate bar from the vending machine for $1 each. Inside every chocolate bar...

Questions in other subjects: