Q:

Python program to find floor division

belongs to collection: Python basic programs

0

When we divide a number by another number – division operator (/) return quotient it may be an integer or float. But, when we need quotient without floating number – we can floor division (//) operator, it returns quotient (result) without floating points.

Example:

    Input:
    a = 10
    b = 3

    # finding division
    result1 = a/b;
    print(result1)

    # finding floor division
    result2 = a//b
    print(result2)

    Output:
    3.3333333333333335
    3

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Python code to find floor division

# python program to find floor division

a = 10
b = 3

# finding division
result1 = a/b
print("a/b = ", result1)

# finding floor division
result2 = a//b
print("a/b = ", result2)

Output

a/b =  3.3333333333333335
a/b =  3

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Python basic programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Python | Some of the examples of simple if else... >>
<< Python program to reverse a given number (2 differ...