?
Solved

VISUAL BASIC CODE

Posted on 2003-02-20
4
Medium Priority
?
309 Views
Last Modified: 2010-04-17
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
Comment
Question by:STEELTIGER
[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
4 Comments
 
LVL 16

Accepted Solution

by:
twalgrave earned 200 total points
ID: 7991310
if x mod 2 = 0 then
  msgbox "Even"
else
  msgbox "Odd"
endif
0
 
LVL 3

Expert Comment

by:AmericanDogma
ID: 7991402
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
 
LVL 9

Expert Comment

by:bhagyesht
ID: 7992126
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!

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

800 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