C# 基础 计算平均值的方法
2015-04-29 10:24
211 查看
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Diagnostics; using System.Runtime.InteropServices; namespace rmb { class Program { static void Main(string[] args) { int[] score = new int[] { 75, 65, 85, 85, 95, 65, 46, 46, 12, 46, 50, 125, 55, 66, 66, 99, 87, 89, 91, 95 }; int sumscore = 0; foreach (var item in score) { sumscore += item; } int sumad = sumscore / score.Length; Console.WriteLine("平均成绩是{0}", sumad); Console.ReadKey(); } } }
相关文章推荐
- 例题:计算运费。c#语言基础,比较简单。看代码输入格式和方法。同样方法可以做一个 出租车打车的程序
- C#基础知识整理:基础知识(5) 方法的重载
- c#基础精华01(强调代码规范,虚方法,抽象方法,接口)
- c#基础--方法(函数)
- 黑马程序员-c#基础加强版之方法控制流复习-3控制台打印密码
- 一个简单方法完成C#时间间隔的计算
- c# 计算字符串和文件的MD5值的方法
- 原码, 反码, 补码的基础概念和计算方法
- [C#] C# 基础回顾 - 匿名方法
- c#扩展方法奇思妙用基础篇二:string 常用扩展
- C# 验证码识别基础方法及源码
- C#基础:多态:基类可以定义并实现虚(virtual)方法,派生类可以重写(override)这些方法
- 追着嘟嘟学c#系列基础第九篇-----c#方法参数【蓝鸥出品】
- 【原创】开源Math.NET基础数学类库使用(12)C#随机数扩展方法
- 黑马程序员_c#基础知识学习笔记:方法重载和out,ref传参
- c#基础知识---匿名方法
- C#基础加强--继承中的构造方法
- c#基础知识---Thread 类常用的属性和方法
- 开源Math.NET基础数学类库使用(11)C#计算相关系数
- 追着嘟嘟学c#系列基础第十一篇-----c#方法重载【蓝鸥出品】