Find the largest interesting number smaller than a given integer

One number is interesting if it's flipped number is divisible by the number of digits it contains. So the program should read from SI an ingeter n(n>9).
Find and print the largest interesting number smaller than n. If the input number is invalid it should print "Invalid input".
So this is the code I've written but I can't get it to work.
I kindly ask for some help.
Thanks in advance

Issues with your code: you effectively destroy n doing the digit count but then try to reuse it for something else without refreshing its value (form largestInteresting?); you don't do the interesting number check in a loop that counts down on the input number so you never find what you're looking for; you wait until the loops are complete before doing the interesting number test, but you don't need to complete the loops once you find the first interesting number if you're counting down.