Codefixer - ASP tutorials, resources and software
ASP.NET 3.5 Hosting – Click Here!
Home   Articles   Resources   ASP directory   ASP Tutorials   Code Snippets   ASP Applications   Forum
Friday 9 May
MembersPro PayPal - ASP Membership software

ASP.NET 3.5 Hosting – DiscountASP.NET


ASP Partner ASP Partner ASP Partner more partners...

Check whether a Number is Odd or Even

The VBScript Mod operator divides two numbers and returns the remainder. So in our code the parameter 'iNumber' passed into our subroutine OddEvenNumber is divided by 2. If the remainder is 0 then the number is even.

<%
Sub OddEvenNumber(iNumber)
If iNumber MOD 2 = 0 Then
Response.write "The number " & iNumber & " is EVEN<br />"
Else
Response.write "The number " & iNumber & " is ODD<br />"
End If
End Sub

'Call our sub and pass in the number 4 as a parameter
Call OddEvenNumber(4)
'Call our sub and pass in the number 13 as a parameter
Call OddEvenNumber(13)
%>

The result of our code above is:
The number 4 is EVEN
The number 13 is ODD

LinksPro - Directory  and Link  Management Software




If you have any code snippets to share with full credit given then send an email to Codesnippets - You'll receive full credit and a link back to your site.

ASP.NET 3.5/2.0 Web Hosting: 3 Months FREE – Click Here!




About | Contact | Advertise | Feedback | Hire Us | Link

Site developed by Michael Wall - Web Design Belfast N.Ireland.
Copyright © 2000-2008. All rights reserved.

Do you intend to move to ASP.NET or have you already?
Yes will do
Have done
ASP does fine
Not a priority


Directory Software