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, 22.06.2019 00:20
What’s resistance in an electrical circuit ?
Answers: 1
question
Computers and Technology, 22.06.2019 10:10
3. bob is arguing that if you use output feedback (ofb) mode twice in a row to encrypt a long message, m, using the same key each time, it will be more secure. explain why bob is wrong, no matter what encryption algorithm he is using for block encryption (15 points).
Answers: 3
question
Computers and Technology, 22.06.2019 19:20
Consider the following code snippet: #ifndef cashregister_h#define cashregister_hconst double max_balance = 6000000.0; class cashregister{public: cashregister(); cashregister(double new_balance); void set_balance(double new_balance); double get_balance() const; private: double balance[12]; }; double get_monthly_balance(cashregister bk, int month); #endifwhich of the following is correct? a)the header file is correct as given.b)the definition of max_balance should be removed since header files should not contain constants.c)the definition of cashregister should be removed since header files should not contain class definitions.d)the body of the get_monthly_balance function should be added to the header file.
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
Negative methods of behavior correction include all but this: sarcasm verbal abuse setting an example for proper behavior humiliation
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
Questions on the website: 13722366