Home » Python » Python programs

Python program to find floor division

floor division in Python: Here, we are going to learn how to find floor division using floor division (//) operator in Python?
Submitted by IncludeHelp, on April 12, 2019

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

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





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL







Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.