Visual Basic Programming Help?
tantrevor07 asked:
Hi, im a little new to programming and i need help in here
hehe a bit stuck ![]()
ok, the problem is how do i program or what is the syntax for determining ODD from EVEN
what i’m trying to make is when you input a number is it will display if its ODD or EVEN
redregistrar.com
Related posts:
- Visual Basic Programming Help? michbox asked: okay i created a simple income calculator but...
- visual basic programming? samuel s asked: trying to write the code to get...
- Does knowing Visual Basic allow me to skip my C++ class? winback asked: I have taken an intro to Visual Basic...
- why is visual basic a good programming language to use? Hussain A asked: why is visual basic a good programming...
- Can anybody send me some notes for MS visual basic programming? Jaya asked: I am a biginer of in programming in...
Filed Under Programming & Design |
Tagged With Syntax, Visual Basic Programming, Visual Programming
Comments
4 Responses to “Visual Basic Programming Help?”
“Public Function IsEven(ByVal Number As Long) As Boolean
IsEven = (Number Mod 2 = 0)
End Function”
divide the number by 2. If you have a remainder then it’s odd.
Use the MOD function.
If myVariable MOD 2 = 0 Then
‘ This is where the variable’s value is even
Else
‘ This is where the variable’s value is odd
End If
Dim myNum as Long
myNum = Val(Text1)
If myNum Mod 2 Then
MsgBox “You’ve entered an odd number.”
Else
MsgBox “You’ve entered an even number.”
End If