zoukankan      html  css  js  c++  java
  • 练习

    Console.Write("请输入月份:");

                int a = int.Parse(Console.ReadLine());

                Console.Write("请输入几号:");

                int b = int.Parse(Console.ReadLine());

                int a1 = 31, a2 = 28, a3 = 31, a4 = 30, a5 = 31,

                a6 = 30, a7 = 31, a8 = 31, a9 = 30, a10 = 31, a11 = 30;

            

                        switch (a)

                        {

                            case 1:

                                Console.WriteLine("第" + b.ToString() + "天");

                                break;

                            case 2:

                                Console.WriteLine("第" + (a1 + b).ToString() + "天");

                                break;

                            case 3:

                                Console.WriteLine("第" + (a1 + a2 + b).ToString() + "天");

                                break;

                            case 4:

                                Console.WriteLine("第" + (a1 + a2 + a3 + b).ToString() + "天");

                                break;

                            case 5:

                                Console.WriteLine("第" + (a1 + a2 + a3 + a4 + b).ToString() + "天");

                                break;

                            case 6:

                                Console.WriteLine("第" + (a1 + a2 + a3 + a4 + a5 + b).ToString() + "天");

                                break;

                            case 7:

                                Console.WriteLine("第" + (a1 + a2 + a3 + a4 + a5 + a6 + b).ToString() + "天");

                                break;

                            case 8:

                                Console.WriteLine("第" + (a1 + a2 + a3 + a4 + a5 + a6 + a7 + b).ToString() + "天");

                                break;

                            case 9:

                                Console.WriteLine("第" + (a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + b).ToString() + "天");

                                break;

                            case 10:

                                Console.WriteLine("第" + (a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + b).ToString() + "天");

                                break;

                            case 11:

                                Console.WriteLine("第" + (a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + b).ToString() + "天");

                                break;

                            case 12:

                                Console.WriteLine("第" + (a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11 + b).ToString() + "天");

                                break;

                                Console.ReadLine();

     

    //100节楼梯,0-49节 是本身的分数
    //从 50以后 每关10分
    //输入所在的节数,求现在的分数
    Console.Write("求输入楼梯节数:");
    int n = int.Parse(Console.ReadLine());
    int m = 0;
    if(n<=100&n>=1)
    for (int i = 1; i <= n; i++)
    {
    if (n <= 49 && n >= 1)
    {
    m = m + i;
    }
    else if (n <= 50 && n >= 100)
    {
    m = m + 10;
    }

    }
    else
    {
    Console.WriteLine("输入有误");
    }
    Console.WriteLine(+m);
    Console.ReadLine();

  • 相关阅读:
    jQuery each的实现与call方法的详细介绍
    转载Entity Framework 5.0(EF first)中的添加,删除,修改,查询,状态跟踪操作
    转载有个小孩跟我说LINQ(重点讲述Linq中GroupBy的原理及用法)
    luogu P3305 [SDOI2013]费用流
    bzoj 4819: [Sdoi2017]新生舞会
    bzoj4817: [Sdoi2017]树点涂色
    bzoj4816: [Sdoi2017]数字表格
    bzoj 4818: [Sdoi2017]序列计数
    [JSOI2007]重要的城市(x)
    BZOJ 1009 [HNOI2008]GT考试
  • 原文地址:https://www.cnblogs.com/yuyingming/p/4930703.html
Copyright © 2011-2022 走看看