when the month is inputted, how many days in that month is the output. I have to take into consideration leap year. the years I am using to determine leap year is 2004,2008,2012,2016
Here is the code I have so far:
Module Module1
Sub Main()
Dim monthnumber As Integer
Dim year As Integer
Dim numberofdays As Integer
Console.WriteLine("Please enter Month number:January=1,February=2 etc.")
monthnumber = (Console.ReadLine())
Console.WriteLine("Please enter year:")
year = Convert.ToBoolean(Console.ReadLine())
Select Case monthnumber
Case 1, 3, 5, 7, 8, 10, 12
numberofdays = "There are 31 days in this month."
Case 4, 6, 9, 11
numberofdays = "There are 30 days in this month."
Case 2
Select Case year
Case 2004, 2008, 2012, 2016
numberofdays = 29
Case Else
numberofdays = 28
End Select
End Select
End Sub
End Module
I know it is wrong, but not sure what I am doing wrong.

New Topic/Question
Reply




MultiQuote





|