using System;
using static
System.Console;
namespace CSarpExamples
{
class LeapYear
{
static int year;
static void Main()
{
WriteLine("Enter the year");
year = Convert.ToInt32(ReadLine());
LeapYear ly = new LeapYear();
ly.LeapYearData();
ReadLine();
}
public void
LeapYearData()
{
if ((year % 4 == 0 && year % 100 == 0) || (year % 400 == 0))
{
WriteLine();
WriteLine("{0}: is leap year", year);
}
else
{
WriteLine();
WriteLine("{0}: is not leap year", year);
}
}
}
}
Output
No comments:
Post a Comment