比较运算符和逻辑运算符

            
//比较运算符:
       // > // < // == // >= // <= // !=
//逻辑运算符  与&& 或||  非!

 

        static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("请输入年份:");
                int year = Convert.ToInt32(Console.ReadLine());
                if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
                {
                    Console.WriteLine("是闰年");
                }
                else
                {
                    Console.WriteLine("非闰年");
                }
                Console.ReadKey();
            }
        }

 

posted @ 2024-08-10 17:16  CSF践行  阅读(1)  评论(0编辑  收藏  举报