integer division
Dividing one whole number by another and keeping only the whole part of the result, so 7 / 2 is 3.
In more detail
Many languages, including Go, C and Java, do this whenever both numbers are integers, so 164 / 200 gives 0. Multiply first, or convert to a floating-point type before dividing, when you need the fraction.
Example
used * 100 / totalRelated terms
- int — The common integer type in many languages, holding whole numbers within a fixed range set by its size in bits.
- type conversion — Turning a value of one type into another, such as the string "23" into the integer 23.
- floating-point number — A number with a fractional part stored in binary, which can only approximate most decimal values.
Taught in
- Variables, Typing, and Zero Values — Concurrent Systems Programming with Go