Check if a number is a Harshad (Niven) number (divisible by the sum of its digits, e.g., 18 ÷ (1+8) = 2).
Difficulty: Medium
Phase: 6 · Mixed Logical Challenges
XP Reward: 20 XP
Topics: Mixed Logical Challenges, Medium
Supported Languages: Python, JavaScript, C, C++, Java
Problem Description
Check whether positive integer N is a Harshad (Niven) number (divisible by the sum of its digits). Print 'Yes' or 'No'. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).
Constraints
- -10^9 <= N <= 10^9
Examples
Example 1
Input: 18
Output: Yes
Explanation: Sample execution for input 18