zyulfi

Even_odd_and_division_by_3

May 14th, 2025 (edited)
864
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | Source Code | 0 0
  1. # Четно/Нечетно и деление на 3
  2.  
  3. # Напишете програма, която приема цяло число и отпечатва:
  4.     # "Четно и се дели на 3", ако се дели на 2 и на 3
  5.     # "Четно", ако се дели само на 2
  6.     # "Дели се на 3", ако се дели само на 3
  7.     # "Нито четно, нито делимо на 3" – в противен случай
  8.  
  9. num = int(input("Please enter integer: "))
  10.  
  11. if (num % 2 == 0 and num % 3 == 0):
  12.     print("The number is even and divisible by 3")
  13. elif (num % 2 == 0):
  14.     print("The number is even")
  15. elif (num % 3 == 0):
  16.     print("The number divisible by 3")
  17. else:
  18.     print("The number is neither even nor divisible by 3")
Advertisement
Add Comment
Please, Sign In to add comment