#K90412. Find Harshad Numbers
Find Harshad Numbers
Find Harshad Numbers
Given two integers a and b, find all Harshad numbers in the range \( [a, b] \) (inclusive). A Harshad number is an integer that is divisible by the sum of its digits. Formally, if \( S(n) \) denotes the sum of digits of \( n \), then \( n \) is a Harshad number if \( n \bmod S(n) = 0 \).
If no Harshad number exists in the given range, output "NO".
inputFormat
The input consists of two integers, a and b, separated by whitespace, representing the lower and upper bounds of the range.
outputFormat
For each Harshad number found in the range [a, b], print it on a new line in ascending order. If no Harshad number exists in the range, output a single line containing "NO".## sample
10 20
10
12
18
20
</p>