Results 1 to 2 of 2

Thread: Odd or even

  1. #1
    Join Date
    Oct 2002
    Posts
    18

    Unanswered: Odd or even

    Can somebody tell me how I can check or a variable is odd or even. I want to use this in a If ... then .. else staemant

    Thanks

  2. #2
    Join Date
    Sep 2002
    Location
    Land of OZ
    Posts
    173

    Re: Odd or even

    Use the MOD function. This gives you the remainder of one number divided by another. So if you take your variable and mod it by 2... see below

    x = Variable MOD 2
    If x = 0 then variable is even else it is odd ....

    Originally posted by harmen
    Can somebody tell me how I can check or a variable is odd or even. I want to use this in a If ... then .. else staemant

    Thanks
    Mona
    ________________________________
    Life is too short to be sane or sensible. Weird people rule and normal people suck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •