Q. Write a program to take two numbers and print if the first number is fully divisible by second number or not.


You can understand by Watching video :-



Answer :-

a = int(input("Enter the number = "))
b = int(input("Enter the divisor = "))
print((a%b == 0 and "It is divisible ") or "It is not divisible" )

Output :-

Enter the number = 4
Enter the divisor = 2
It is divisible

>>> 

Enter the number = 654165
Enter the divisor = 6
It is not divisible

>>> 

Enter the number = 2
Enter the divisor = 562163
It is not divisible

>>>

8 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. a = int(input("enter the number = "))
    b = int(input("enter the divisor = "))
    print((a%b == 0 and "it is divisible ") or "it is not divisible")

    in last there will be only bracket as i typed

    ReplyDelete
  2. x = int(input("Enter the First Number "))
    y = int(input("Enter the Second Number "))
    if x%y ==0:
    print(x,"and",y,"is divisible")
    else:
    print(x,"and",y,"not divisible")

    this also works

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post