If else Control Structure in VB.NET with Odd Even Checking Examples
In this blog we another example program of If Else control structure in VB.NET.
Module Example7
Sub main()
Dim Num As Integer
Console.Write("Enter a Number: ")
Num = Console.ReadLine()
If Num Mod 2 = 0 Then
Console.WriteLine(" Even Number")
Else
Else
Console.WriteLine(" Odd Number")
End If
End Sub
End Module
In the above program a new thing we saw Mod use of this
operater is it returns remainder in the
division and all others are same as in the previous example program. The above program checks whether the entered
number is Odd number or Even number. Even number is a number which is divisible
by 2 . Odd number is opposite of even number i.e number not divisible by2.
No comments:
Post a Comment