Answer to Question #297437 in Python for Touhid

Question #297437

Write the Python code of a program that reads an integer, and prints the integer it is a multiple of either 2 or 5 but not both. If the number is a multiple of 2 and 5 both, then print "Multiple of 2 and 5 both


1
Expert's answer
2022-02-13T14:43:53-0500
print('Enter integer: ', end='')
n = int(input())
if (n % 2 == 0) & (n % 5 == 0):
    print('Multiple of 2 and 5 both')
elif (n % 2 == 0) | (n % 5 == 0):
    print(n)
    

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS