program.cs
来自「csharp课本的源代码」· CS 代码 · 共 25 行
CS
25 行
using System;
using System.Collections.Generic;
using System.Text;
namespace UncertaintyTransferExample
{
class Program
{
public static float Average(params long[] v)
{
long total, i;
for (i = 0, total = 0; i < v.Length; ++i)
total += v[i];
return (float)total / v.Length;
}
static void Main()
{
float x = Average(1, 2, 3, 5);
Console.WriteLine("1、2、3、5的平均值为{0}", x);
x = Average(4, 5, 6, 7, 8);
Console.WriteLine("4、5、6、7、8的平均值为{0}", x);
Console.ReadLine();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?