0

I have a recrusive program -Im new to it!- that gives all the possible ways to make a money to smaller coins for example :

we want 10$

the coins are 5$ , 2$ , 1$

we can give 1 5$ , 2 2$ , 1 1$

or only 10 1$

the inpit is n the number of coins , then the coins , then the money we want to change

```
#include <iostream>
using namespace std;
int coins[100],n,m,nowqcoins[100];
void halatcoint ( int m , int nowcoins[] , int mon )
{
int h;
h=m;
h++;
if (mon==0)
{
for (int i=0;i<n;i++)
cout<<coins[i]<<"*"<<nowcoins[i]<<" ";
cout<<endl;
}
else
while (mon>=0 && m<n)
{
halatcoint( h , nowcoins , mon);
mon -= coins[m];
nowcoins[m]+=1;
}
}
int main()
{
cin>>n;
for (int i=0;i<n;i++)
{
cin>>coins[i];
}
cin>>m;
halatcoint ( 0 , nowqcoins , m);
cin>>n;
}
```

heres my code but I cant find my problem with it , in first numbers it gives right numbers but then it gives heroic numbers . thank you!