// Copyright (c) 2013, 烟台大学计算机学院
// All rights reserved.
// 作 者: 沈远宏
// 完成日期:2014 年 09月04日
// 版 本 号:v1.0
//问题描述:输入一个年份,判断是否润年(被4整除,且不被100整除,或者被400整除)
// 输出:是否为闰年
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please input the year:");
string s = Console.ReadLine();
int year = int.Parse(s);
if ((year%4==0&&year%100 != 0)||year%400 == 0)
{
Console.WriteLine("该年是闰年!");
Console.ReadLine();
}
else
{
Console.WriteLine("该年是平年!");
Console.ReadLine();
}
}
}
}
运行结果:
心得体会:
总会有一种感觉,就是再用C#的时候总会想起C++编这个程序的时候, = =难道我如此深情嘛。。
C#和C++输入输出完全不一样啊,倒是和JAVA 差不多,
各有各的好处,希望能体验到每一种语言的优劣