What is the error..it is giving adress as output

hello @garganshul151
i think it is printing garbage value.

initialise ur dp array completely wiht 0.
and thn try

https://ide.codingblocks.com/s/293647…now it is giving zero

it is correct.
change ur input for other values

https://ide.codingblocks.com/s/293647…now it is giving zero

because for ur input answer was 0.

chnage input for different output.

ex->
image