Dividing two numbers

suggest change

When dividing two numbers, pay attention to the type you want back. Dividing two integers uses integer division. For a float result, at least one operand must be a Float.

Integer division:

3 / 2 # => 1

Float division:

3 / 3.0 # => 1.0

16 / 2 / 2    # => 4
16 / 2 / 2.0  # => 4.0
16 / 2.0 / 2  # => 4.0
16.0 / 2 / 2  # => 4.0

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents