Alice, 4136 bytes
/o
\i@/!w?wh+.?Fn$K.0~\~\ & /+?-$K..?\ L z $ /K
Try it online!Try it online!
Explanation
This program has a really nice mix and interaction between Cardinal (integer-processing) and Ordinal (string-processing) mode.
The usual framework for challenges with decimal I/O which operate largely in Cardinal mode:
/o
\i@/...
And the actual program:
! Store the input N on the tape.
We'll use an implicit zero on top of the stack as our iterator variable X,
which searches for the first valid result.
w Store the current IP position on the return address stack. This marks
the beginning of the main search loop. We can avoid the divisibility
test by going up in increments of N. To check the other two
conditions, we'll use individual conditional loop ends that skip to
the next iteration. Only if both checks pass and all loop ends are
skipped will the search terminate.
?+ Increment the iterator X by N.
. Duplicate X.
?~ Put a copy of N underneath.
\ Switch to Ordinal mode.
& Implicitly convert X to a string, then fold the next command over its
characters, i.e. its digits. Here, "fold" means that each character
is pushed to the stack in turn, followed by one execution of that
next command.
/ Switch back to Cardinal mode (this is not a command).
- Fold subtraction over the digits. This implicitly converts each
digit back to its numerical value and subtracts it from N. If the
digit sum of X is equal to N, this will result in 0.
$K Jump back to the w if the digit sum of X isn't N.
.. Duplicate X twice.
? Get a copy of N.
\ Switch to Ordinal mode.
L Shortest common superstring. Implicitly converts X and N to strings
and gives the shortest string that starts with X and ends with N.
This will be equal to X iff X already ends with N. Call this Y.
z Drop. If X contains Y, this deletes everything up to and including
Y from X. This can only happen if they are equal, i.e. if X ended
with N. Otherwise X remains unchanged.
$ Skip the next command if the string is empty, i.e. if X ended with N.
/ Switch back to Cardinal mode.
K Jump back to w if X didn't end with N.