Solved

Is even or odd?

Posted on 2000-03-03
4
303 Views
Last Modified: 2011-09-20
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
Comment
Question by:blue021097
  • 3
4 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 50 total points
ID: 2581555
Function EvenOrOdd(num)

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

End Function
0
 

Author Comment

by:blue021097
ID: 2581645
(Edited by Computer101), it is not working.
0
 
LVL 32

Expert Comment

by:jhance
ID: 2581673
Well what's it doing?
0
 
LVL 32

Expert Comment

by:jhance
ID: 2581683
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now