Menu
Coddy logo textTech

Gifts

Lesson 21 of 32 in Coddy's Coding Problems course.

challenge icon

Challenge

Medium

If you have N money and you want to buy gifts for your friends. The store nearby sells the gift for a price of A dollars, but the store further sells them for less, B dollars (A > B). 

Calculate how many more gifts you can buy if you go to the store further away.

 

Write a function named gifts that given three natural numbers N, A and B from input. Return how many more gifts you can buy for a price of B dollars instead of price of A dollars.

 

Input
22 6 5

Output
1

Input
30 7 4

Output
3

Try it yourself

int gifts(int a1, int a2, int a3) {
    // Write code here
}

All lessons in Coding Problems