Welcome folks today in this blog post we will be
checking whether the given number is harshad number or not in python All the full source code of the application is shown below.
In order to get started you need to make a
app.py file and copy paste the following code
num = int(input("Enter a number: ")) digit = sum = 0 temp = num # Calculates sum of digits while(temp > 0): digit = temp % 10 sum = sum + digit temp = temp // 10 # Checks whether the number is divisible by the sum of digits if num % sum == 0: print(num, "is a Harshad Number!!!") else: print(num, "is not a Harshad Number!!!")