C caillaud Member Licensed User Longtime User Feb 28, 2012 #1 Hi how to know if a number odd or even is? dim x as int x=5 odd x=4 even sincerely michel
joseluis Active Member Licensed User Longtime User Feb 28, 2012 #2 Mod returns the rest of a division. Mod 2 of a number will return 0 if the number is divisible by 2. So you can do something like: B4X: If x Mod 2 == 0 Then Log("Number is even") Else Log("Number is odd") End If Upvote 0
Mod returns the rest of a division. Mod 2 of a number will return 0 if the number is divisible by 2. So you can do something like: B4X: If x Mod 2 == 0 Then Log("Number is even") Else Log("Number is odd") End If
C caillaud Member Licensed User Longtime User Feb 28, 2012 #3 odd and even hi thanks a lot I am stupid sincerely michel Upvote 0