VOTERS (EXCEPTION HANDLING)
PROGRAM:
Module Module1
Sub Main()
Dim vname As String
Dim age As Integer
Try
Console.Write("Enter your
Name:")
vname = Console.ReadLine()
Console.Write("Enter your
Age:")
age =
Int32.Parse(Console.ReadLine())
If (age >= 18) Then
MsgBox("Hi Your age is
greater than 18, so you are eligible for vote")
Else
MsgBox("Sorry Your age is less than 18, so you are not
eligible for vote")
End If
Catch ex As Exception
Console.WriteLine("Exception
is:" & ex.Message)
Console.ReadLine()
End Try
End Sub
End Module
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home