Hi,
Sometimes you may need to find whether a particular year is leap year or not. But how can you find out whether a particular year is leap year or not in C# ? Use the following code.
using System; class MainClass { public static void Main() { bool myResult= DateTime.IsLeapYear(2011); Console.WriteLine("Is the year 2011 a leap year ? = " + myResult); } }
And the output is,
Is the year 2011 a leap year ? = False
🙂
Cool site
In sql
declare @num int;
set @num=1996;
select case when (@num%4)=0 and ((@num%100)0 and (@num%400)0) then ‘Yes’ else ‘no’ end;