% symbol for java expressions

pts.
Tags:
Java
Hi, Im trying to get back into java (its been a while) and i was wondering what % means in a expression. E.G 5 % 3 Appreciate any and all help Thanks Andy

Answer Wiki

Thanks. We'll let you know when a new response is added.

% operator when used in such a scenario returns the modulus (remainder) of the number.
for e.g.

10 % 3 would return 1.
55 % 4 would return 3.

It is same as (x mod y) where x and y are (integers/numbers).

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Samachar
    Yah Sunil is right. % is an operator which is used to find the remainder or we can call it modulus of a division. e.g. 12%5=2 And more especially want to add one more thing that :- Unlike c/c++ java % operator can be used with the float datatype. Thank you, Dillip Rout.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: