Does anyone know how to solve the next lucky ticket problem? | Sololearn: Learn to code for FREE!

+2

Does anyone know how to solve the next lucky ticket problem?

if you haven't heard it then let me describe it.. let's assume you bought a lottery ticket which has number in 6 digits and you're considered as a winner if the sum of first three digits is equal to last three digit. you've to check the number. if it's already lucky number then fine else you've to print next lucky number. you can't change the first three digits. ... if anyone know how to solve it.. please tell me.

7/29/2017 12:28:10 PM

Rijwan Khan

1 Answer

New Answer

0

"next" lucky number means the closest to the original, be it smaller or greater, right? I mean, if your original number is 100700 the closest would be 100100. Is that so? If not, clarify. Give some examples.