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"
Chat with our AI personalities
"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
find even number in array
The final supported version was Visual Basic 6.0. Since then (1998~2008?) a langauge called Visual Basic .NET has joined the .NET framework. This is basically a complete redesign/reimplementation of the language for the new framework. Microsoft has even kept the VB version numbers in sequence with the original. The latest version of this language is Visual Basic 2008 (VB 9.0).
using system; { public static void main(string[] args) { int n; n=int.parse(console.ReadLine()); if(n%2==0) console.WriteLine("Even number"); else console.WriteLine("Odd number"); } }
In visual basic: Module Module1 Sub Main() Dim Inst As Integer For Inst = 0 To 100 Step 2 Console.WriteLine(Inst) Next End Sub End Module
basic is a general purpose, high level programming language. and the same is with the visual basic. but the main difference is that, the earlier basic was the dos version language. whereas the visual basic programming language is the language which is not DOS based. but the simplicity in the language remains the same as in basic.