class leapyear
{
static void Main(string[] args)
{
leapyear obj = new leapyear();
obj.rd();
obj.leap();
}
int y;
public void rd() //rd=readdata
{
Console.WriteLine("Enter the Year in Four Digits : ");
y = Convert.ToInt32(Console.ReadLine());
}
public void leap()
{
if ((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0))
{
Console.WriteLine("{0} is a Leap Year", y);
}
else
{
Console.WriteLine("{0} is not a Leap Year", y);
}
Console.ReadLine();
}
}
-------------------
OUTPUT
Enter the Year in Four Digits : 2002
2002 is not a Leap Year
-------------------
{
static void Main(string[] args)
{
leapyear obj = new leapyear();
obj.rd();
obj.leap();
}
int y;
public void rd() //rd=readdata
{
Console.WriteLine("Enter the Year in Four Digits : ");
y = Convert.ToInt32(Console.ReadLine());
}
public void leap()
{
if ((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0))
{
Console.WriteLine("{0} is a Leap Year", y);
}
else
{
Console.WriteLine("{0} is not a Leap Year", y);
}
Console.ReadLine();
}
}
-------------------
OUTPUT
Enter the Year in Four Digits : 2002
2002 is not a Leap Year
-------------------
good blog.. thanks for nice updates
ReplyDeleteThanks :)
Delete