• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

C++ Code Question

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.
I'm assuming that you're looking at integers (whole numbers) instead of floats (numbers with decimals). You'd use the mod operator. For example,

10 / 3 = 3. integer division. 10 divided by 3 = 3.

10 % 3 = 1. modulus (remainder) operation. 10 divided by 3 has a remainder of 1.

If one number is divisible by another, the modulus would be 0.
 
Back