knapsack problem using greedy method algorithm in c