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: 310
  • Last Modified:

VISUAL BASIC CODE

I know this is pretty basic but I'm looking for the correct VB code that determines if a number is ODD or EVEN.  In other words, when a user enters a number into an input box and clicks ok..what's the code that determines the number to be ODD or EVEN.  Thanks if anyone can help

STEELTIGER
0
STEELTIGER
Asked:
STEELTIGER
1 Solution
 
twalgraveCommented:
if x mod 2 = 0 then
  msgbox "Even"
else
  msgbox "Odd"
endif
0
 
AmericanDogmaCommented:
The code above is correct.

Mod returns the remainder of a number (x listed above) divided by another number (2 listed above) so 2 Mod 2 = 0 and 7 Mod 2 returns 1

And so on

AD
0
 
bhagyeshtCommented:
homework?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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