bob bob - 18 days ago 7
Vb.net Question

Vb.net checking if a number is a mutliple of another number

I need to check if a number is a multiple of another number. So I can output a certain string or do a certain function. Is there a simple way or easy way of doing this.

Answer

The "modulus" or "mod" operator gives you the remainder of a division operation. So if the remainder is 0, then you know the numbers are multiples. This is also used for determining if numbers are odd or even. Simply do a mod (%) with 2, and if the answer is 0 then it's even, and 1 it's odd

Comments