Charlie once visited chocolate factory to buy some chocolates.Chocolate cost Rs. 3 each and he had only Rs. 45.He was disappointed. He wanted more. But when he reached the factory he was amazed. There was a scheme on that special day. If you return 3 wrappers of the chocolate you will get one chocolate for free. So how many chocolates can he buy?

22

Charlie has Rs. 45 and each chocolate cost Rs. 3. So he buys only 15. But there is a scheme. He will return 15 wrappers and get 5 chocolates free. Then he will return 3 out of 5 and get one free. And he will again use one wrapper with the remaining 2 to get one more.

So 15+5+1+1 = 22.

## Comments

Sign uporlog in with Facebookto comment.KUNWAR UTKARSH22

Job DellAnswer should be 15. The question is how many chocolates can he buy right? 22 is so wrong!!!

AlyIt would help if the questio were rephrased to read "How many chocolates can he GET?"

First he buys 15, then ...

RAMSju

Mahmoud El-Banna22

Urvesh Devani22 and 1 wrapper left

15 chocolates from 45 Rs. generates 15 wrappers => 5 more chocolates generates 5wrappers => 1 more chocolate + 2 wrappers generates 1 more wrapper => 3 wrappers=> 1 more chocolate 1 wrapper left

RaviUrvesh, there's a

Show Solutionbutton to check if your solution is correct!Urvesh Devaniyep! forgot to see that. . . :P

blingoNice to find a formula for the general case whereas there's 'n' instead of '45'...

Alexander BjørndalSum of (n/3^i) from i = 0 to i = ∞ But it gives 22.5 for 45

Alexander BjørndalThe formula is incorrect ... It assumes that money and wrappers can be used together to buy new chocolate

Ligin Vellakkad22

Mudaser AliTotal: 22Srikanth Ayalasomayajulu22

hardikasawa21

hardikasawa22 actually.. didn't realize in end he will have 2 wrappers + 1 chocolate => 3 chocolates..

Ashutoshits -: 15+5+1+1

Sukesh Pabba22 Chocolates And 1 wrapper is left

Sourabh22

Tarun24522 chocolates and 1 wrapper left

Alexander BjørndalHow about this?

Vishal barotgood one just needs patience.

Adrean PalmaActually, he can only buy 15 chocolates...the others are free.

Yoshi GillaspieA ruby solution. You could also build in different wrapper trade in ratios or different costs of chocolate bars.

class Buyer attr

reader :chocbars def initialize(cash = 45, choc_bars = 0)end

def get

datchocolateend

private def trade

inwrappersend

def spend_monies

end end

x = Buyer.new x.get

datchocolateJustyn FeeneyThe real answer should be 15... He can only BUY 15.. the last 7 he got free for trading in wrappers.

ashutosh aggarwal22

Josh HomerHe can only BUY 15. The other 7 he gets are free as per the parameters of the question.

Sarath VarunRs. 45 = Rs.3 * 15 Chocolates 15 Chocolates = 15 Wrappers 3 Wrappers = 1 Chocolate 15 Wrappers = 5 Chocolates.. so totally 20 CHOCOLATES...!!!

Sarath VarunRs. 45 = Rs.3 * 15 Chocolates 15 Chocolates = 15 Wrappers 3 Wrappers = 1 Chocolate 15 Wrappers = 5 Chocolate(3 Wrappers = 1 Chocolates.)..

15+5+1+1=22 so totally 22 CHOCOLATES...!!!

Vivek Agarwal22

Sankhadeep22

Anutharsha22