def allDigitsAreEven(number):
number=abs(number)
while (number > 0):
rem = number % 10
if (rem % 2 != 0):
return False
number = int(number / 10)
return True
number =int(input())
numberCounter1=number
numberCounter2=number
while not allDigitsAreEven(numberCounter1):
numberCounter1-=1
while not allDigitsAreEven(numberCounter2):
numberCounter2+=1
diff1=number-numberCounter1
diff2=number-numberCounter2
lowestNumber=numberCounter1
if diff1>diff2:
lowestNumber=numberCounter2
print(lowestNumber)
Comments
Leave a comment