Hello.
In objective c (Mac development). How can i find out if a number is divisible by another number and not a decimal?
Hello.
In objective c (Mac development). How can i find out if a number is divisible by another number and not a decimal?
Assuming you're dealing with integers, use the modulus function:
if ((a % b) == 0) {
// A is divisible by B
} else {
// A isn't divisible by B
}
I'm not a objective c programmer, but in general, just checking if A mod B = 0 should do it... won't it work in OC?
cheers.