Indian coin change algorithm code in giving error


when i give input it also prints the extra number at the end of the input and if there is no number exists at the end it prints the + operator.
i want to print like this
for eg. the input is 62

output
50+10+2= 62

and i don’t want to print any extra number of index value.

You can store all the values in an array or vector first.
And then work on it. If its empty, just display no solution exists.
Otherwise traverse the array and print the data accordingly.