Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,907 questions

51,839 answers

573 users

How to check if year is leap year in VB.NET

2 Answers

0 votes
Imports System

Public Class Program
    Public Shared Function IsLeapYear(ByVal year As Integer) As Boolean
        If year Mod 4 = 0 AndAlso year Mod 100 = 0 AndAlso year Mod 400 = 0 Then
            Return True
        ElseIf year Mod 4 = 0 AndAlso year Mod 100 = 0 Then
            Return False
        ElseIf year Mod 4 = 0 Then
            Return True
        Else
            Return False
        End If
    End Function

    Public Shared Sub Main(ByVal args As String())
        Console.Write(If(IsLeapYear(2020), "Leap Year", "Not a Leap Year"))
    End Sub
End Class
	
	
	
	
' run:
'
' Leap Year
'

 



answered Oct 16, 2022 by avibootz
0 votes
Imports System

Public Class Program
    Public Shared Function IsLeapYear(ByVal year As Integer) As Boolean
        Return year Mod 4 = 0 AndAlso (year Mod 100 <> 0 OrElse year Mod 400 = 0)
    End Function

    Public Shared Sub Main(ByVal args As String())
        Console.Write(If(IsLeapYear(2020), "Leap Year", "Not a Leap Year"))
    End Sub
End Class

	
	
	
	
' run:
'
' Leap Year
'

 



answered Oct 16, 2022 by avibootz

Related questions

3 answers 1,107 views
1,107 views asked May 23, 2015 by avibootz
3 answers 158 views
158 views asked Oct 16, 2022 by avibootz
3 answers 226 views
3 answers 235 views
1 answer 101 views
3 answers 190 views
...