复制代码 代码如下:
class Program
{
static void Main(string[] args)
{
Console.WriteLine(Sum(1));
Console.WriteLine(Sum(1, 2, 3));
Console.WriteLine(Sum(1, 2, 3, 4, 5));
Console.ReadKey();
}
private static int Sum(params int[] values)
{
int sum = 0;
foreach (int value in values)
sum += value;
return sum;
}
}
新闻热点
疑难解答
图片精选