minimization

The Question is -
A Milkman serves milk in packaged bottles of varied sizes. The possible size of the bottles are {1, 5, 7 and
10} litres . He wants to supply desired quantity using as less bottles as possible irrespective of the size. Your objective is to help him find the minimum number of bottles required to supply the given demand of milk.
My code is here:

But it gives me a wrong answer .Can anyone suggest me where i am wrong .Thanks in advance.

this question belongs to tcs codevita which is running currently.please remove solution As early as possible.

=3= deleted my answer. :l so that’s why he asked two questions here simultaneously. what a lazy guy.

//