Saturday 14 September 2024

Practical - 62 - Write a program in python that takes two numbers from the user and check whether 1st number is divisible by 2nd number or not. print “Divisible” if number is divisible otherwise print “Not Divisible”

Practical - 62 - Write a program in python that takes two numbers from the user and check whether 1st number is divisible by 2nd number or not. print “Divisible” if number is divisible otherwise print “Not Divisible”


Ans:

a=int(input("Enter first number: "))

b=int(input("Enter second number: "))

if a%b==0:

    print("Divisible")

else:

    print("Not Divisible")

 

Output:

Enter first number: 15

Enter second number: 3

Divisible

OR

Enter first number: 15

Enter second number: 4

Not Divisible


No comments:

Post a Comment