0

Given the coin denominations 1, 3, and 5, what is the minimum number of coins needed to

make change for a given value?

Hint:

Value 1 2 3 4 5 6 7 8 9 10

Min.

no.

Coins 1 2 1 2 1 2 3 2 3 2

Parameter to be used : the amount of Money M and

the array of denominations C.

I have to use this relation:

minNumCoins(M-1) + 1

minNumC oins(M-3) + 1

minNumCoins(M-5) + 1

Underlining all the red words and giving me this error: The method minNoCoins(int m,int []C) in the type coins is not applicable for the arguments int.Please help me with this program

```
import java.util.Scanner;
public class coins {
public static int minNoCoins(int m,int []C)
{
for (int i=0;i<3;i++)
if (m>=5)
{
return minNoCoins(m-C[2])+1;
}
else if (m>=3)
{
return minNoCoins(m-C[1])+1;
}
else if (m==1)
{
return minNoCoins(m-C[0])+1;
}
else return 0;
}
public static void main(String[] args) {
Scanner input= new Scanner(System.in);
int C[]={1,3,5};
System.out.println ("Enter amount of Money:");
int m=input.nextInt();
for (int i=0;i<3;i++)
System.out.println("Min number of coins: "+minNoCoins(m,C[i]));
}
}
```