《零基础学C#》第七章-实例01:计算圆的面积

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wtxhai/article/details/88719106
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Example701
{
    class Program
    {
        static double r;
        const double PI = 3.14;
        static void Main(string[] args)
        {
            Console.Write("请输入半经:");    //提示输入半径
            Program.r = Convert.ToDouble(Console.ReadLine());   //获取输入的半经值
            Console.WriteLine("圆的面积是:" + PI * Math.Pow(r, 2));   //计算圆的面积
            Console.ReadLine();
        }
    }
}

猜你喜欢

转载自blog.csdn.net/wtxhai/article/details/88719106