N = 216
result = 0
for M in range(1, N + 1):
digit_sum = 0
temp = M
while temp > 0:
digit_sum += temp % 10
temp //= 10
if M + digit_sum == N:
result = M
break
print(result)
To embed this project on your website, copy the following code and paste it into your website's HTML: