zoukankan      html  css  js  c++  java
  • C# 1作业 2广场砖面积 护栏长度

    作业1输入圆柱体的底面半径和高求体积

     

    wpsBE43.tmp 

            static void Main(string[] args)

            {

                  //输入圆柱体的底面半径,高。求体积?

                int r, h;

                double v;

                //输入

                Console.Write("请输入圆柱底面半径:");

                string s1 = Console.ReadLine();

                r = Convert.ToInt32(s1);

                Console.Write("请输入圆柱体的高:");

                string s2=Console.ReadLine();

                h = Convert.ToInt32(s2);

     

                //运算

                v = 3.14 * r * r * h;

     

                //输出

                Console.WriteLine("圆柱体的体积是:"+v);

     

     

            }

     

     

    作业 2广场砖面积  护栏长度

    wpsBE83.tmp

     

    // static void Main(string[] args)
            {

    const double PI = 3.14;      

          const int BAR_UNIT_PRICE = 25;     

           const int BRICK_UNIT_PRICE = 85;     

           //输入       

         int a, b;           

    Console.Write("请输入泳池半径:");         

       string s1 = Console.ReadLine();      

          a = Convert.ToInt32(s1);        

        Console.Write("请输入广场半径:");           

    string s2 = Console.ReadLine();          

      b = Convert.ToInt32(s2);

                //运算        

        double l = 2 * PI * a;    //求泳池的周长      

          double area1 = PI * a * a;//泳池的面积。  

              double area2 = PI * b * b;//总面积。       

         double area = area2 - area1;//广场面积        

        double barPrice = l * BAR_UNIT_PRICE; //护栏的总造价       

         double brickPrice = area * BRICK_UNIT_PRICE;//广场的造价。

                //输出      

          Console.WriteLine("护栏的长度是" + l + "米,广场砖的总面积是" + area + "平米,总造价为" + (barPrice + brickPrice) + "");      }

     

     

  • 相关阅读:
    <Learning How to Learn>Week One: Focused versus Diffuse Thinking
    "Principles of Reactive Programming" 之<Actors are Distributed> (2)
    "Principles of Reactive Programming" 之<Actors are Distributed> (1)
    "reactive programming"的概念
    "Principles of Reactive Programming" 之 <Persistent Actor State>学习笔记
    从List[Future[T]]到Future[List[T]]
    用IDEA调试Play工程
    Scala的Pattern Matching Anonymous Functions
    Akka的fault tolerant
    Manifest 与TypeTag
  • 原文地址:https://www.cnblogs.com/981971554nb/p/4309657.html
Copyright © 2011-2022 走看看