Python Programming 4th Edition: - Write a program that test and display if a number enter is divisible by 2 and/or 3. Hints: - Use the correct operation - Prompt the user to enter a number The output should look like as follows - Enter an integer: --Number is divisible by 2 and 3 --Number is divisible by either 2 or 3, but not both --Number is not divisible by either 2 or 3
# Code.py n = int(input("Enter an integer: ")) if(n%2==0 and n%3==0): print("Number is divisible by 2 and 3") elif(n%2==0 or n%3==0): print("Number is divisible by either 2 or 3, but not both") else: print("Number is not divisible by either 2 or 3")
Get Answers For Free
Most questions answered within 1 hours.