Computer Science

Write a Python program that accepts two integers from the user and prints a message saying if first number is divisible by second number or if it is not.

Python

Python Funda

53 Likes

Answer

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

if a % b == 0:
    print(a, "is divisible by", b)
else:
    print(a, "is not divisible by", b)

Output

Enter first number: 15
Enter second number: 5
15 is divisible by 5

Enter first number: 13
Enter second number: 7
13 is not divisible by 7

Answered By

25 Likes


Related Questions