#K68517. Harshad Number Checker

    ID: 32882 Type: Default 1000ms 256MiB

Harshad Number Checker

Harshad Number Checker

A Harshad number (or Niven number) is an integer that is divisible by the sum of its digits. More formally, an integer \( N \) is a Harshad number if:

\( N \mod (\text{sum of the digits of } N) = 0 \)

Your task is to determine, for multiple given integers, whether each integer is a Harshad number. For each integer, output "Yes" if it is a Harshad number and "No" otherwise.

Input will be provided via standard input (stdin) and output should be printed to standard output (stdout).

inputFormat

The first line contains an integer \( T \) representing the number of test cases. The following line contains \( T \) space-separated integers.

Example:

3
18 19 21

outputFormat

For each test case, output a line containing "Yes" if the given number is a Harshad number, otherwise output "No".

Example output for the above input:

Yes
No
Yes
## sample
3
18 19 21
Yes

No Yes

</p>