using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace PI { class Program { static void Main(string[] args) { const Double PI=3.1415926; Console.WriteLine("请输入圆的半径:"); float r = Convert.ToInt32(Console.ReadLine()); double s =PI * (r * r); Console.WriteLine("圆的半径是{0},面积是:{1}",r,s.ToString("0.000"));//限制输出的位数 Console.ReadKey(); } } }
时间: 2024-09-29 06:04:36