class Program { static void Main(string[] args) { //举例:写一个方法,判断一个年份是否是润年 bool b =isRun(2019); //调用isRun方法 Console.WriteLine("今年是润年吗?是为True,否为False: " + b); Console.ReadKey();
}
public static bool isRun(int year)
{
bool b = (year % 400 == 0) || (year%4==0 && year%100!=0);
return b;
}
}