Problem F
Harshad Numbers
We’re all familiar with harshad numbers. For this problem, you will ... what’s that? You aren’t familiar with harshad numbers? They’re also known as Niven numbers – does that ring a bell?? Anything???
Well, it’s a simple enough concept. A harshad
number is a number which is evenly divisible by the sum of its
digits. For example,
OK, let’s start over.
We’re all familiar with harshad numbers. For this problem,
you will be given a number
Input
Input consists of a single line containing a positive
integer
Output
Display the smallest harshad number greater than or equal to
Sample Input 1 | Sample Output 1 |
---|---|
24 |
24 |
Sample Input 2 | Sample Output 2 |
---|---|
25 |
27 |
Sample Input 3 | Sample Output 3 |
---|---|
987654321 |
987654330 |