Question: C code please! ***Please provide the correct code with taking input and give the output as given in the image only. If correct code with

 C code please! ***Please provide the correct code with taking input

C code please! ***Please provide the correct code with taking input and give the output as given in the image only. If correct code with the same required output is provided then I will Upvote for sure or else I will downvote. Thank You....

Write a C program for the following problem. There are n items in the suitcase of a traveler. On boarding the flight, the airline company told him that his suitcase is over weight than the allowed capacity W and asked him to deload some items and not to carry more than W. He knows weight of each item. Devise an algorithm to find out which items to be discarded so that he can carry max. weight W. (assume the weight of the suitcase is ignored). Note: The objective here is that he must carry maximum items. For example Weights of items : 532 1 W=6 Output: 0111 Weights of items : 20 12 10 7 5 W=27 Output: 00111 Note: Read number of items, knapsack capacity and weights of items from the user. Print the solution. For example: Input Result 4 0 1 1 1 6 5 3 2 1 5 0 0 1 1 1 27 20 12 10 7 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!