+ 2

How to find set of (a,b,c) such that: a*b*c = d, with d is input parameters and a#b#c. (JAVA)

Test Case: input 12 Output 1,2,6 and 1,3,4 When I run my code, the output is 1,2,6 2,6,1 ..., 1,3,4 1,4,3. How can I print only two sets 1,2,6 and 1,3,4 https://code.sololearn.com/cMh2mefZTnN1/?ref=app

9th Nov 2022, 10:53 AM
Lily
Lily - avatar
4 Respuestas
+ 2
in loops, start from b=a, and c = b ( skip already checked one).. Then while printing a, b, c are distinct.
9th Nov 2022, 11:26 AM
Jayakrishna 🇮🇳
+ 2
I did it. Thank you so much!!
9th Nov 2022, 12:09 PM
Lily
Lily - avatar
+ 1
You're welcome..
9th Nov 2022, 12:18 PM
Jayakrishna 🇮🇳
0
Hay
13th Nov 2022, 5:39 PM
Pushpendra Rajpoot
Pushpendra Rajpoot - avatar