An Efficient Way to Find Mod Value For Using Mod of Even

To determine whether a number is divisible by some even number you have to use the Mod operator in VB. The following code is an alternate, faster way of doing this:

 Private Function GetRemainder(iNumber As Integer,iDivisor As Integer)As IntegerGetRemainder=iNumber And (iDivisor-1)End Function


Note: This function will only work for getting the remainder when the number is divisible by an even number. It doesn

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: