## Problem – Chef and Chocolates CodeChef Solution

Chef wants to gift *C* chocolates to Botswal on his birthday. However, he has only *X* chocolates with him.

The cost of 1 chocolate is *Y* rupees.

Find the **minimum** money in rupees Chef needs to spend so that he can gift *C* chocolates to Botswal.

### Input Format

- First line will contain
*T*, number of test cases. Then the test cases follow. - Each test case contains of a single line of input, three integers
*C*,*X*, and *Y*.

### Output Format

For each test case, output in a single line answer, the **minimum** money in rupees Chef needs to spend.

### Constraints

- 1≤
*T*≤100 - 1≤
*C*≤100 - 0≤
*X*≤*C* - 1≤
*Y*≤100

### Sample 1:

**Input**: 2
7 5 5
10 1 1
**Output**: 10
9

### Explanation:

**Test Case 1:** Chef has to gift a total of 7 chocolates out of which he has 5 chocolates. Thus, Chef needs to buy 2 more chocolates, which costs him 10 rupees.

**Test Case 2:** Chef has to gift a total of 10 chocolates out of which he has 1 chocolate. Thus, Chef needs to buy 9 more chocolates, which costs him 9 rupees.

### Chef and Chocolates CodeChef Solution in Java

```
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner scn= new Scanner(System.in); //System.in is a standard input stream
int T= scn.nextInt();
for(int i=0; i<T; i++){
int C= scn.nextInt();
int X= scn.nextInt();
int Y= scn.nextInt();
System.out.println((C-X)*Y);
}
}
}
```

### Chef and Chocolates CodeChef Solution in C++17

```
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int a,b,c;
cin>>a>>b>>c;
int rem = a-b;
int cost = rem*c;
cout<<cost<<endl;
}
return 0;
}
```

### Chef and Chocolates CodeChef Solution in Pyth 3

```
T = int(input())
for i in range(T):
C,X,Y = map(int,input().split())
print((C-X)*Y)
```

##### Chef and Chocolates CodeChef Solution Review:

In our experience, we suggest you solve this Chef and Chocolates CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Chef and Chocolates CodeChef Solution

**Find on CodeChef**

##### Conclusion:

I hope this Chef and Chocolates CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

**More Coding Solutions >>**

**LeetCode Solutions**

**Hacker Rank Solutions**

**CodeChef Solutions**