C#代码判断闰年

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _02判断闰年
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            int year = int.Parse(textBox1.Text);
            int i = year % 4;
            int j = year % 400;
            if (i==0 || j==0)
            {
                label2.Text = year.ToString() + "是闰年";
            }
            else
            {
                label2.Text = year.ToString() + "是平年";
            }
        }
    }
}

猜你喜欢

转载自blog.csdn.net/qq_43551373/article/details/85603897