Answer to Question #289821 in Python for loss

Question #289821

1. Visibly Divisible

by CodeChum Admin

Do you still know what being divisible by a certain number means? In case you forgot, being divisible means that the number is capable of being divided by another number without a remainder. With this knowledge, you can surely solve this problem!


Instructions:

  1. Input one integer.
  2. Make a conditional statement that contains the following conditions:
  3. If the integer is only divisible by 3, print "Divisible by 3"
  4. If the integer is only divisible by 4, print "Divisible by 4"
  5. If the integer is divisible by both 3 and 4, print "Divisible by 3 and 4"

Input

A line containing an integer.

6

Output

A line containing a string.

Divisible·by·3







1
Expert's answer
2022-01-22T16:36:25-0500
num = int(input("Enter an integer: "))
Flag=0
if(num%3==0): Flag=1
if(num%4==0): Flag=2
if(num%3==0 and num%4==0): Flag=3


if(Flag==1):
    print("Divisible by 3")
if(Flag==2):
    print("Divisible by 4")
if(Flag==3):
    print("Divisible by 3 and 4")

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
New on Blog
APPROVED BY CLIENTS