Python program to check number is divided by 3 and 5

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
  1. Take a number as input through the user.
  2. Use if-else statements to check whether the given number is divisible by 3 and 5 also.
  3. 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

assign grades as per total marks.

print the square of the number if it is divided by 11.

Leave a Comment