For example, if you have 20 dollars then you can initially buy20 chocolate bars.
ID: 3609882 • Letter: F
Question
For example, if you have 20 dollars then you can initially buy20 chocolate bars. This gives you 20 coupons. You can redeem14 coupons for two additional chocolate bars. These twoadditional chocolate gives you two more coupons, so now you have atotal of eight coupons. This gives you enough to redeem forone final chocolate bar. As a result you now have 23 chocolatebars and two leftover coupons.
Write a program that inputs the number of dollars and outputshow many chocolate bars you can collect after spending all yourmoney and redeeming as many coupons as possible. Also outputthe number of leftover coupons. The easiest way to solve thisproblem is to use a loop.
Explanation / Answer
#include using namespace std; int main(){ int numDollars; coutnumDollars; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.