{"id":6709,"date":"2021-05-22T10:14:18","date_gmt":"2021-05-22T04:44:18","guid":{"rendered":"https:\/\/python-programs.com\/?p=6709"},"modified":"2021-11-22T18:40:46","modified_gmt":"2021-11-22T13:10:46","slug":"harshad-number-in-python","status":"publish","type":"post","link":"https:\/\/python-programs.com\/harshad-number-in-python\/","title":{"rendered":"Harshad Number in Python"},"content":{"rendered":"

Harshad Number:<\/strong><\/p>\n

A Harshad number is one whose original number is divisible by the sum of its digits.<\/p>\n

like 5 , 18 , 156 etc.<\/p>\n

Example 1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

number=18<\/pre>\n

Output:<\/strong><\/p>\n

18 is harshad number<\/pre>\n

Explanation:<\/strong><\/p>\n

Here sum_of_digits=9 i.e (1+8 ) and 18 is divisible by 9<\/pre>\n

Example 2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

number=19<\/pre>\n

Output:<\/strong><\/p>\n

19 is not harshad number<\/pre>\n

Explanation:<\/strong><\/p>\n

Here sum_of_digits=10 i.e (1+ 9 ) and 19  is not divisible by 10<\/pre>\n

Harshad Number in Python<\/h3>\n

Below are the ways to check harshad number in python<\/p>\n