Java Remainder of Integer Divison?

后端 未结 5 1305
甜味超标
甜味超标 2021-01-18 01:44

I was searching around about this topic but I still don\'t get it, if someone can elaborate I would be very thankful.

My task is to divide two variables as integer d

5条回答
  •  遥遥无期
    2021-01-18 02:21

    int remainder = a % b; will sort you. The remainder operator returns the remainder of the division.


    Note that the remainder operator is also called the modulo operator. However, this is incorrect for Java as Java will return a negative value if the left operand a is negative.

提交回复
热议问题