Console App : Use SELECT Case statement to Check the Day of the Week

Chikul
Posted by Chikul under VB.NET category on | Views : 4549
Module Module1

Sub Main()
Dim str As String
Console.WriteLine("Enter nth Day of Week :")
str = Console.ReadLine()
If IsNumeric(str) And (Val(str) > 0 And Val(str) < 8) Then
Select Case CInt(str)
Case 1
Console.WriteLine("SunDay")
Case 2
Console.WriteLine("MonDay")
Case 3
Console.WriteLine("TuesDay")
Case 4
Console.WriteLine("WednesDay")
Case 5
Console.WriteLine("ThursDay")
Case 6
Console.WriteLine("FriDay")
Case 7
Console.WriteLine("SaturDay")
End Select
Else
Console.WriteLine(str & " is not a Valid day of Week.")
End If
Console.ReadLine()
End Sub

End Module

Comments or Responses

Login to post response