VB.Net program to check the given year is leap year or not using conditional operator
'VB.Net program to check the given year is
'Leap year or not.
Module Module1
Sub Main()
Dim year As Integer = 0
Dim result As String
Console.Write("Enter the year: ")
year = Integer.Parse(Console.ReadLine())
result = If(((year Mod 4 = 0) AndAlso Not (year Mod 100 = 0)) OrElse
((year Mod 4 = 0) AndAlso (year Mod 100 = 0) AndAlso (year Mod 400 = 0)),
"Entered is Leap Year",
"Entered is not Leap Year"
)
Console.WriteLine(result)
End Sub
End Module
Output
Enter the year: 2004
Entered is Leap Year
Press any key to continue . . .
Table of Contents