In this Python program, we will learn how to check if the entered number by the user is divisible by Both 3 and 7 or Not.
Here is the code of the program to check if the entered number by the user is divisible by 3 and 7 or Not.
# Python Program to Check if a Number is Divisible by 3 and 7 or Not
# Take the Input From the User
number = int(input("Enter any Positive Number: "))
if((number % 3 == 0) and (number % 7 == 0)):
print("Given Number {0} is Divisible by 3 and 7".format(number))
else:
print("Given Number {0} is Not Divisible by 3 and 7".format(number))
Enter any Positive Number: 5
Given Number 5 is Not Divisible by 3 and 7
Enter any Positive Number: 21
Given Number 21 is Divisible by 3 and 7
Comments