using System;
class abc
{
int year;
bool a;
public void fun()
{
Console.WriteLine("Enter the year it is leap year or not");
year = Convert.ToInt32(Console.ReadLine());
switch (a = (year % 4 == 0))
{
case true:
Console.WriteLine("The year is leap year");
break;
case false:
Console.WriteLine("The year is not leap year");
break;
}
Console.ReadKey();
}
}
class leaps
{
public static void Main(string[] args)
{
abc a = new abc();
a.fun();
}
}
Output
class abc
{
int year;
bool a;
public void fun()
{
Console.WriteLine("Enter the year it is leap year or not");
year = Convert.ToInt32(Console.ReadLine());
switch (a = (year % 4 == 0))
{
case true:
Console.WriteLine("The year is leap year");
break;
case false:
Console.WriteLine("The year is not leap year");
break;
}
Console.ReadKey();
}
}
class leaps
{
public static void Main(string[] args)
{
abc a = new abc();
a.fun();
}
}
Output
No comments :
Post a Comment