Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Nibbles

is X divisible by 10?

This topic is 6075 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, how do I check to see if X is divisible by 10? I assume I need the % operation, however I''m not too good with it. Thanks Scott Email Website
"If you try and don''t succeed, destroy all evidence that you tried."

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by wojtos
Hi, how do I check to see if X is divisible by 10? I assume I need the % operation, however I''m not too good with it.



The modulus (%) operator returns the remainder. Ex. a % b returns the remainder of a/b. If the remainder is zero (a % b == 0) then then a is divisible by b.

Share this post


Link to post
Share on other sites
One thing that might be totally obvious (to me anyway) is that 4%5 would be 4... just something to remember

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!