Test a given number is even or odd

Satyapriyanayak
Posted by Satyapriyanayak under VB.NET category on | Points: 40 | Views : 818
In this Code Snippet we will know how to test a given number is even or odd. 

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As Integer
x = TextBox1.Text
If x Mod 2 = 0 Then
MsgBox("The Number is Even")
Else
MsgBox("The Number is Odd")
End If
End Sub
End Class

Comments or Responses

Login to post response