C# Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace leapYearCheck
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the year");
int year = Convert.ToInt32(Console.ReadLine());
if (DateTime.IsLeapYear(year))
{
Console.WriteLine("Leap Year");
}
else
Console.WriteLine("Not a Leap Year");
Console.ReadKey();
}
}
}
Output:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace leapYearCheck
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the year");
int year = Convert.ToInt32(Console.ReadLine());
if (DateTime.IsLeapYear(year))
{
Console.WriteLine("Leap Year");
}
else
Console.WriteLine("Not a Leap Year");
Console.ReadKey();
}
}
}
Output:
No comments:
Post a Comment