Click here to Skip to main content
15,893,190 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi Experts,
Please Help me develop below logic in C++.
I have to find smallest number in combination of three number whose multiplication is hundred.
e.g 1
(554)=5X5X4=100
(455)=4X5X5=100
(545)=5X4X5=100
Here least number is 455.
e.g 2
(435)=4X3X5=60
(345)=3X4X5=60
(534)=5X3X4=60
Here least number is 345.
instead of 100 or 60 we can also take another number I take these number just for example.

In case of C# please not used LINQ.
Posted
Updated 24-Feb-16 2:55am
v4
Comments
PIEBALDconsult 24-Feb-16 8:43am    
It's _your_ homework; _you_ do it.
Patrice T 24-Feb-16 16:18pm    
how can you senior developer and ask how to solve this problem ?
Member 10641779 25-Feb-16 6:58am    
what kind of logic you need? who is providing these numbers like 554,455,545?? if numbers are already given you can just find the least number.
Member 10641779 25-Feb-16 7:00am    
If you need to find numbers you can do like this http://cpp.sh/5dyt
Er. Dinesh Sharma 25-Feb-16 7:23am    
I have a number(Input) e.g 100 find the all combination of three digits whose multiplication is 100 like above example (5*5*4=100).

1 solution

Which is it C++ or C#; not that it matters, since the logic is exactly the same. Start by writing down the steps needed for the algorithm, e.g.
Select next value
Split into single digits
Multiply together to check total
Check whether larger or smaller than previous value
Repeat
 
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