Solved

Odd & Even Number.

Posted on 2000-05-04
3
397 Views
Last Modified: 2011-09-20
hi,

How to detect the input number is odd or even number?
0
Comment
Question by:zamirjalil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
setiawan earned 1 total points
ID: 2779242
Hi zamirjalil,

It is easy,

just mod the number with 2, if the result equal to zero then It is even others is odd

<% if (a mod 2) = 0 then
      response.write "Even"
   else
      response.write "Odd"  
   end if
%>
  danny
0
 

Author Comment

by:zamirjalil
ID: 2779263
Thanks danny,
BTW anything wrong with my code?

<%
if request("bdate")<> "" or request("bkod")<>"" or request("bjan")<>"" then

if Isdate(request("bdate")) then
 birthdate=request("bdate")
 age=datediff("yyyy",date(),birthdate)
else
birthdate=Cdate(mid(request"bdate"),3,2)&"/"&mid(request("bdate"),5,2)&"/"&left(request("bdate"),2))
age=datediff("yyyy",birthdate,date())
response.write "Your age now is:" & age & " years old."
end if

 if IsNumeric(request("bjan")) then
  inumur = request("bjan")
  if (inumur mod 2) = 0 then
   response.write inumur & "is an EVEN  number."
   response.write "You r a girl!"
  else
   response.write inumur & "is an ODD number."
   response.write "You r a man!"
  end if
end if %>
0
 

Author Comment

by:zamirjalil
ID: 2779274
sorry..a careless mistake...i found it. missing end if statement. Thanks everybody.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

688 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