Saturday, 23 May 2020

Python Program to check Divisibility of two numbers

Divisibility of Numbers

Let a and b be the two numbers.
Divisibility says that b can completely divides a if their remainder is Zero.
i.e. a%b=0

Program:

In this program, we will check the divisibility of numbers by applying simple formula given above.

#Program: To check divisibility of two numbers
#Author: Hitendra E. Suryavanshi

a=int(input("Enter a number"))
b=int(input("Enter a number"))
if a%b==0:
    print("a is fully divisible by b")
else:
    print("a is not fully divisible by b")

Output 1:

Enter a number10
Enter a number5
a is fully divisible by b

Output 2:

Enter a number7
Enter a number2
a is not fully divisible by b


Thank You
Hitendra E. Suryavanshi
M.Tech.(IT), BE (IT)







No comments:

Post a Comment

How to take input in Python?

How to read input in Python? In Python 3, input() function is used for taking input from the keyboard. The input() function in Python 3 i...