+ 2

JAVA question to find all the duck numbers from 1 to n

Guys, I need some help!! Please help me in telling me only the loop part(the complete nested loop part) for finding all the duck numbers 1 to n(number entered by the user). A Duck number is a number which has zeroes present in it, but there should be no zero present in the beginning of the number. For example 3210, 8050896, 70709 are all duck numbers whereas 02364, 03401 are not. Thanks in advance!

14th Sep 2017, 12:33 PM
Karan Kumar
Karan Kumar - avatar
3 Answers
+ 3
Right man! Thanks @3xhaust!
14th Sep 2017, 6:35 PM
Karan Kumar
Karan Kumar - avatar
+ 2
Just did the code, check it out: https://code.sololearn.com/cUU741UcM35W/#java
16th Sep 2017, 11:10 AM
Karan Kumar
Karan Kumar - avatar
+ 1
i would give you a hint: use a while loop (that checks if a number is a duck number) inside a for loop(that runs from 1 to n)
14th Sep 2017, 4:00 PM
3xhaust
3xhaust - avatar