用Visual Studio判断闰年和非闰年
1、打开Visual Studio,选择新建项目。
2、点击Visual C#,选择右边的控制应用台。
3、代码 int year; for (int i = 0; i 争犸禀淫< 6; i++) { Console.Write("请输入年乍鋈继琪份: "); year = int.Parse(Console.ReadLine()); if (year % 4 == 0) { if (year % 100 == 0) { if (year % 400 == 0) Console.WriteLine("{0}年是闰年! ", year); else Console.WriteLine("{0}年不是闰年! ", year); } else { Console.WriteLine("{0}年是闰年! ", year); } } else { Console.WriteLine("{0}年不是闰年! ", year); } Console.ReadLine();
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:23
阅读量:38
阅读量:30
阅读量:93
阅读量:62