human
Smallest number greater than or equal to N which is divisible by its non | Function to find the smallest number greater than or equal to N such that it is divisible by its non - zero digits.
Iterate in range [ N , N + 2520 ].
To check if the current number satisfies the given condition.
Store the number in a temporary variable.
Loop until temp > 0.
Check only for non zero digits.
Extract the current digit.
If number is divisible by current digit or not.
Otherwise , set possible to 0.
Break out of the loop.
Divide by 10.
Driver Code.
Function Call"
Solution in Python:
assistant
#Here is code to smallest number greater than or equal to N which is divisible by its non and the other steps required.
 def findSmallestNumber ( n ) :
	for i in range ( n , n + 2521 ) :
		possible = 1
		temp = i
		while ( temp ) :
			if ( temp % 10 != 0 ) :
				digit = temp % 10
				if ( i % digit != 0 ) :
					possible = 0
					break
			temp //= 10
		if ( possible == 1 ) :
			print ( i , end = " " )
			return
if __name__ == " _ _ main _ _ " :
	N = 31
	findSmallestNumber ( N )