• C#语言,从键盘输入一个年份和一个月份,判断该月是多少天!


    Console.WriteLine("请输入一个年份:");
    int year = Convert.ToInt32(Console.ReadLine());
    Console.WriteLine("请输入一个月份:");
    int month = Convert.ToInt32(Console.ReadLine());
    switch (month)
    {
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12: Console.WriteLine("该月有31天!"); break;
    case 4:
    case 6:
    case 9:
    case 11: Console.WriteLine("该月有30天!"); break;
    case 2:
    if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
    {
    Console.WriteLine("今年是闰年!有29天!");
    }
    else
    {
    Console.WriteLine("今年是平年!有28天!");
    }
    break;
    default: Console.WriteLine("您输入的月份错误!"); break;
    }

  • 相关阅读:
    图片剪切
    js事件(Event)知识整理
    原生JavaScript事件详解
    underscore源码解析
    win7 vi工具
    开源java数据库库
    win7快捷键
    win7 绿色版MySQL安装与配置
    maven jetty
    javax inect
  • 原文地址:https://www.cnblogs.com/Jasxu/p/3021937.html
Copyright © 2020-2023  润新知