answersLogoWhite

0

I don't now visual basic, but to determine whether or not a number is even or odd, divide it by two twice, and round once. If the rounded result is equal to the non-rounded result, then the original number is even:

input n

if (n/2.0) == int(n/2.0)

print "the number is even"

User Avatar

Wiki User

15y ago

Still curious? Ask our experts.

Chat with our AI personalities

CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
ViviVivi
Your ride-or-die bestie who's seen you through every high and low.
Chat with Vivi
More answers

"Odd"

Dim number As Integer

For number = 30 To 90000

If number Mod 2 = 1 Then

Listbox1.Items.Add(number)

End If

Next

"Even"

Dim number As Integer

For number = 30 To 90000

If number Mod 2 = 0 Then

Listbox1.Items.Add(number)

End If

Next

End Sub

User Avatar

Wiki User

14y ago
User Avatar

Add your answer:

Earn +20 pts
Q: What is an odd and even number program in visual basic?
Write your answer...
Submit
Still have questions?
magnify glass
imp