Did your teacher tell you that with 20$ you could obtain 23 candies?
From reading the problem it stands to reason that you have to PURCHASE a candy to receive a coupon. Reedeming 1 coupon to receive 1 candy+ another coupon doesn't make sense to me.
1$ = 1 candy + 1 coupon.
Therefore: 20$ = 20 candy + 20 coupon.
20 coupon = 2 candy + 6 remaining coupons.
Therefore 20 candy + 2 candy = 22 candy total with still only 6 coupons.. no? (not 8)
As for your code as is:
1) Might want to choose variable names more relevant/informative than s & n or your teacher will have a hissy fit.
2) Your loop has no changing condition as the above poster mentioned leading to an infinite loop.
3) There are better ways to keep your console window open than a cin >>.. been awhile since I programed a console app, but I think something like getCh() or worst case System("pause")
4) The code n=money+(money/7); by itself may give you the correct answer if you only get a coupon upon 1$ purchase rather than your current 1$ purchase or 1 coupon redeem. Do you want to use a loop or do you have to use a loop?
A valid loop requires a changing condition.. Example:
int money, ;
cin >> money;
int candies = 0;
int coupons = 0;
int changingVariable = 0; // This variable controls the loop and changes. Of course you wouldn't call it changingVariable
while (changingVariable < money)
candies = candies + 1;
coupons = coupons + 1;
changingVariable = changingVariable + 1;