How to print the exact products that are chosen to maximize the profit in knapsack problem?

Generally we are only asked the maximum / minimum value that can be obtained in a knapsack type problem. What if you are also asked to print the exact products to choose to obtain the max/min value?