Sunday 28 April 2024

Write a program to check if a number is divisible by 3 and 5

 number = int(input("Which number do you want to check? "))

if number % 3 == 0 and number % 5 == 0:

  print("This number is divisible by 3 and 5.")

elif number % 3 == 0 and number % 5 != 0:

  print("This number is divisible by 3 but not 5.")

elif number % 3 != 0 and number % 5 == 0:

  print("This number is divisible by 5 but not 3.")  

else:

  print("This number is not divisible by 3 or 5.")