human
Largest number not greater than N all the digits of which are odd | Function to check if all digits of a number are odd.
iterate for all digits.
if digit is even.
all digits are odd.
function to return the largest number with all digits odd.
iterate till we find a number with all digits odd.
Driver Code"
Solution in Python:
 ... Give me a code to largest number not greater than N all the digits of which are odd and the other steps required?
assistant
#Here is code to largest number not greater than N all the digits of which are odd and the other steps required.
 def allOddDigits ( n ) :
	while ( n ) :
		if ( ( n % 10 ) % 2 == 0 ) :
			return False
		n = int ( n / 10 )
	return True
def largestNumber ( n ) :
	if ( n % 2 == 0 ) :
		n -= 1
	i = n
	while ( 1 ) :
		if ( allOddDigits ( i ) ) :
			return i
		i -= 2
if __name__ == ' _ _ main _ _ ' :
	N = 23
	print ( largestNumber ( N ) )