zoukankan      html  css  js  c++  java
  • 例题:100节楼梯,0-49节,分数等于节数。50节(包括50节)以后每节10分。输入节数,得出分数。这个题如果按照讲页来做是错误的,所以再写一遍,请大家指导

     while (true)

                {

                    Console.Write("请输入你的楼梯数:");

                    int n = Convert.ToInt32(Console.ReadLine());

                    int fenshu = 0;

                    if (n > 100)

                    {

                        Console.WriteLine("您输入的楼梯数有误!");

                                        }

                    else

                    {

                        for (int i = 1; i <= n; i++)   //根据输入的楼梯数来循环

                        {

                            if (n< 50)         //加条件,在50节楼梯以下怎么计算得分

                                 {

                                fenshu =  n;

                            }

                            else

                            {

                                //fenshu = 49 + (n - 49) * 10;

                                fenshu = n * 10;

                            }  

                       }

                        Console.WriteLine("爬" + n + "个楼梯,您的得分是" + fenshu);

                     }               

  • 相关阅读:
    (转载)什么才是富人思维
    linux上的vs code的C++环境搭建
    [转载]双线性插值简介
    刻意练习行动手册
    滑动窗口技巧
    [转载]用于深入思考的小工具
    CF632E Thief in a Shop
    BZOJ1497 最大获利
    UVA10779 Collectors Problem
    洛谷P4311 士兵占领
  • 原文地址:https://www.cnblogs.com/275147378abc/p/4437196.html
Copyright © 2011-2022 走看看