dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Jun 5, 2001

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


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 Integer
GetRemainder=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
Prasad Haridass
 
Thanks for your registration, follow us on our social networks to keep up-to-date