Harshad Numbers

Published by Harith in

A number n is a Harshad (also called Niven) number if it is divisible by the sum of its digits. For example, 666 is divisible by 6 + 6 + 6, so it is a Harshad number.

Write a function to determine whether the given number is a Harshad number.

Examples

isHarshad(209) ➞ true

isHarshad(41) ➞ false

isHarshad(12255) ➞ true

Notes

N/A

Watch a quick demo on how Edabit works.