Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

Is even or odd?

Does someone have a function in which I can pass an
Integer and it would return True if Even or False if odd?

Please be clear in your answer, I am new to ASP.

0
blue021097
Asked:
blue021097
  • 3
1 Solution
 
jhanceCommented:
Function EvenOrOdd(num)

 If ((num / 2) * 2) = num Then
   EvenOrOdd = True
 Else
   EvenOrOdd = False
 End If

End Function
0
 
blue021097Author Commented:
(Edited by Computer101), it is not working.
0
 
jhanceCommented:
Well what's it doing?
0
 
jhanceCommented:
OK, I see the problem.  Try it like this:

Function EvenOrOdd(num)

                     If (Int((num / 2)) * 2) = num Then
                       EvenOrOdd = True
                     Else
                       EvenOrOdd = False
                     End If

End Function
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now