• Create Account

### #ActualCornstalks

Posted 13 August 2012 - 11:23 PM

You're doing it right there in your code (just above the if statement). See that % operator? That's the modulus operator. Simplified explanation, a % b tells you the remainder when you divide a by b, and if the remainder is zero, a is in fact a multiple of b, and the result of a / b is an integer. So you would just do:
if (i % 3 == 0)
// i is divisible by 3, and thus i / 3 is an integer


### #1Cornstalks

Posted 13 August 2012 - 11:22 PM

You're doing it right there in your code (just above the if statement). See that % operator? That's the modulus operator. Simplified explanation, a % b tells you the remainder when you divide a by b, and if the remainder is zero, a is in fact a multiple of b, and the result of a / b is an integer. So you would just do:
if (i % 3 == 0)
// i is divisible by 3


PARTNERS