write a program in BASIC to calculate price of 60 chocolate when each chocolate cost rs 50
Answers
Answer:
hope it helps
Explanation:
find the total number of maximum chocolates you can eat.
money: Money you have to buy chocolates
price: Price of a chocolate
wrap: Number of wrappers to be returned for getting one extra chocolate.
It may be assumed that all given values are positive integers and greater than 1.
Examples:
Input: money = 16, price = 2, wrap = 2
Output: 15
Price of a chocolate is 2. You can buy 8 chocolates from
amount 16. You can return 8 wrappers back and get 4 more
chocolates. Then you can return 4 wrappers and get 2 more
chocolates. Finally you can return 2 wrappers to get 1
more chocolate.
Input: money = 15, price = 1, wrap = 3
Output: 22
We buy and eat 15 chocolates
We return 15 wrappers and get 5 more chocolates.
We return 3 wrappers, get 1 chocolate and eat it
(keep 2 wrappers). Now we have 3 wrappers. Return
3 and get 1 more chocolate.
So total chocolates = 15 + 5 + 1 + 1
Input: money = 20, price = 3, wrap = 5
Output: 7