division versus modulus operator – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-ICSE2017-01D #JAVA#4104    siteicon   siteicon  

Problem Statement - division versus modulus operator

Write one difference between / and % operator.

Solution

TC++ #4104

when / (division) operator is used we get the value of numerator (value before /) divided by denominator (value after /). In case of % (modulus) operator we get the remainder of division operation as done in the previous case.

Notes

  • Unlike many other languages like c/c++, java allows % operation for float and double also, but one has to take care regarding the rounding off errors due to precision range.


Share

sunmitra| Created: 28-Mar-2018 | Updated: 15-Apr-2019|ICSE2017






Back