Python 3 Script to Check Whether the Given Number is Harshad Number or Not Full Project For Beginners

 

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.

 

 

 

Get Started

 

 

 

In order to get started you need to make a app.py file and copy paste the following code

 

 

app.py

 

 

 

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!!!")

 

See also  Python 3 Tkinter Encode Text or String to Binary Code Converter GUI Desktop App Using Regular Expression Library Full Project For Beginners

 

 

 

 

Leave a Reply