CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

What is the difference between / and % operator?


Open in App
Solution

Answer:

Both / and % are two different operators used in Java. These operators are mathematical operators and both have different uses.

  • / Only perform the division operation in mathematics and returns results as the quotient.
  • While % is known as modulus.
  • / divides and returns the answer.

Example

8/2 = 4

% divides and returns the remainder.

Example:

13 % 2 = 6 and reminder is 1.

Articles to Explore:

  1. Conclusion For Java Project
  2. How many types of logical operators are there?

flag
Suggest Corrections
thumbs-up
6
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Algebra of Limits
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon