In this, if else program, we will check whether the given number is divided by 3 and 5 or not.
Hint:
Use AND(&) with if-else statement.
Steps to solve the program
- Take a number as input through the user.
- Use if-else statements to check whether the given number is divisible by 3 and 5 also.
- If yes then then print True, if not then print False.
# Take input through the user
num = int(input("Enter a number: "))
# Check for division
if num%3 == 0 and num%5 == 0:
# Print output
print("Given number can divide by both 3 and 5")
else:
# Print output
print("Given number can not divide by 3 and 5")
Output :
Enter a number: 6
Given number can not divide by 3 and 5
Enter a number: 15
Given number can divide by both 3 and 5
Related Articles
- Python program to print the square of the number if it is divided by 11.
- Python program to check given number is a prime number or not.
- Python program to check given number is odd or even.
- Python program to check a given number is part of the Fibonacci series from 1 to 10.
- Python program to check authentication with the given username and password.
- Python program to validate user_id in the list of user_ids.