1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6
7 namespace ConsoleApplication10
8 {
9 class Program
10 {
11 static void Main(string[] args)
12 {
13 double radius = 3;
14 double high = 3.5;
15 double superficial;
16 double vol = volume(radius,high,out superficial);
17 Console.WriteLine("表面积为:{0},体积为{1}",superficial,vol);
18 Console.ReadKey();
19 }
20 static double volume(double radius, double high,out double superficial )//计算面积与体积的方法
21 {
22 double area = 3.14 * radius * radius;//圆的面积公式S=πr²
23 double lateral = 2 * 3.14 * radius * high;//圆柱体侧面积=底面圆周长×高=2×3.14×底面半径×高
24 superficial = lateral + (area * 2);//侧面积+底面积乘以2
25 double volume = area * high;//体积
26 return volume;
27 }
28 }
29 }