KnowledgeBoat Logo

Computer Applications

What is the difference between / and % operator?

Java Operators

ICSE 2011

114 Likes

Answer

Division operatorModulus operator
Returns the quotient of division operationReturns the remainder of division operation
Example: int a = 5 / 2; Here a will get the value of 2 which is the quotient of this division operationExample: int b = 5 % 2; Here b will get the value of 1 which is the remainder of this division operation

Answered By

63 Likes


Related Questions