subject

Suppose you can buy a chocolate bar from the vending machine for $1 each. inside every chocolate bar is a coupon. you can redeem seven coupons for one chocolate bar from the machine. you would like to know how many chocolate bars you can eat, including those redeemed via coupon, if you have n dollars. for example, if you have 20 dollars then you can initially buy 20 chocolate bars. this gives you 20 coupons. you can redeem 14 coupons for two additional chocolate bars. these two additional chocolate bars give you two more coupons, so you now have a total of eight coupons. this gives you enough to redeem for one final chocolate bar. as a result you now have 23 chocolate bars and two leftover coupons. write a program that inputs the number of dollars and outputs how many chocolate bars you can collect after spending all your money and redeeming as many coupons as possible. also output the number of leftover coupons. the easiest way to solve this problem is to use a loop.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:30
Given the following code: if (n == 2) { k -= 2; } else if (n == 3) { k -= 3; } can be rewritten as: if (< condition > ) { < assignment statement > ; } assume that evaluating < condition > does not change the values stored in n and k. which of the following could be used as < assignment statement > ? k -= n; k -= 1; k -= 2; k += n; k = n - k;
Answers: 2
question
Computers and Technology, 21.06.2019 22:30
This isn’t really school related, but like where the heck can you find manga, to read to where you don’t have to pay money, for points? my friend wants me to read bj alex, and i can’t find it anywhere for free.
Answers: 2
question
Computers and Technology, 22.06.2019 01:20
What is the full meaning of rfid in computer
Answers: 2
question
Computers and Technology, 22.06.2019 09:00
What is one way in which tablets differ from laptops and notebooks? tablets are designed for touch-based interaction. tablets are designed to be used as desktops. tablets are designed for input via a keyboard and mouse. tablets are designed to be larger than laptops.
Answers: 1
You know the right answer?
Suppose you can buy a chocolate bar from the vending machine for $1 each. inside every chocolate bar...
Questions
question
Mathematics, 27.05.2020 21:08
Questions on the website: 13722367