Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Assuming that there are n tyres that could be used by a car,tricycle and a bicycle. I need to write an algorithm to accept n-tyres and generate all d possible combinations of car(s), tricycle(s) and bicycle(s) that will exhaust the n-tyres.

For example:
Since cars need 4 tyres, tricycles need 3 tyres and bicycles need 2 tyres, the all the possible combinations to EXHAUST 10 tyres are listed below:
2 Cars and 1 Bicycle
1 Car and 3 Bicycles
1 Car and 2 Tricycles
2 Tricycles and 2 Bicycle
5 Bicycles.


These are all the combinations possible for car, tricycle and bicycle to exhaust 10 tyres.

Please can you help me with the code in any language (preferably in C#) that can generate the combinations above for n-tyres.
Thanks
Posted
Comments
Member 10776385 9-Jun-14 16:30pm    
Thanks for your swift reply.
I have searched the resources in the link provided but I've not found any that answer my question.

1 solution

Yes If you refer below Link You will find many resources from CP
combinations C#[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900