Math Fundamentals18 sections · 814 units
Open in Course

Integer Division

Discarding the remainder

Regular division gives you decimals: 7÷3=2.333...7 \div 3 = 2.333.... But integer division throws away the decimal part and keeps only the whole number: 7÷3=27 \div 3 = 2.

In most languages, if both operands are integers, division is integer division. Python uses //// for explicit integer division. C++ and Java do it automatically when both operands are int types.

This comes up constantly. If you have nn items and want to split them into groups of kk, the number of full groups is n/k\lfloor n / k \rfloor.