R
R
raury2020-03-05 15:58:43
ruby
raury, 2020-03-05 15:58:43

Why is the remainder of the division different?

puts (5 % 3)     # prints  2  
puts (-5 % 3)    # prints  1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
#
#, 2020-03-05
@raury

and so:
- 3 + 1 = 2
base here https://ru.wikipedia.org/wiki/%D0%94%D0%B5%D0%BB%D...
disputes about implementation, apparently here https:// www.ruby-lang.org/en/community/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question