Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

HarryWorksInc

macrumors regular
Original poster
Is there anyway to check for multiples of a certain number? I would do something like:
HTML:
if (num==0) {
        //code
} else if (num==5) {
        //code
} else if (num==10) {
        //code
}
But these numbers will go into the thousands so it would be very complicated to do it that way.

Thanks
 
Look up the modulo operator in C, represented by the % symbol.
Code:
if ( (num % 5) == 0 ) ...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.