Floor division
Floor division is a division operation that rounds the result down to the nearest whole number or integer, which is less than or equal to the normal division result. The floor function is mathematically denoted by this ⌊ ⌋ symbol.
Let’s understand this concept through the slides below:
1 of 4
Code
Several programming languages have a specific built-in function or operator for calculating floor division.
floor()method is used in C++Math.floor()is used in Java//operator is used in Python
Floor division in C++
Here is the coding example of floor division in C++.
#include <iostream>//include math library#include <cmath>using namespace std;int main() {// floor() method is used.cout << "Floor of 36/5 is " << floor((double)36/5) << endl;return 0;}
Floor division in Java
Here is the coding example of floor division in Java.
class FloorDivision {public static void main( String args[] ) {System.out.print( "Floor of 36/5 is " );//Math.floor() method is used below:System.out.println(Math.floor((double)36/5));}}
Floor division in Python
Here is the coding example of floor division in Python.
print("Floor of 36/5 is")print(36//5)
Free Resources
Copyright ©2025 Educative, Inc. All rights reserved