In: Computer Science
Write anoutput(number)functionthat printsout information according to the requirements below.-If numberis a multiple of 3and 4, print"Multiple of 3 and 4". -If numberis onlya multiple of 4, print "Multiple of 4".-If numberis onlya multiple of 3, print "Multiple of 3". -If numberis not a multiple of 3or 4, print "Not a multiple of 3or 4"
>>output(12)'Multiple of 3 and 4'>>>output(8)'Multiple of 4'>>>output(5)'Not a multiple of 3 or 4
The output shows that the program should be written on python. Please find the program below.
def output (number):
if number%3==0 and number%4==0 :
return (str(number)+" is multiple of 3 and 4")
elif number%3==0 :
return (str(number)+" is multiple of 3")
elif number%4==0 :
return (str(number)+" is multiple of 4")
else:
return(str(number)+" is not a multiple of 3 or 4")
# Getting user input
number=int(input("Enter a number : "))
# Calling thefunction and printing the output
print(output(number))