python从键盘输入10个整数、求平均数_编程:从键盘输入10个整数存入数组啊,输入该数组各元素,并求其最大值,最小值和平均值...

这段代码展示了如何使用C#编程从键盘输入10个整数,然后计算并输出这些整数的最大值、最小值和平均值。通过`Score`类实现了求解最小值、最大值和平均值的方法。使用`using`语句管理资源,确保在完成操作后释放对象。此外,还解释了`using`关键字在定义范围和导入命名空间方面的用途。
摘要由CSDN通过智能技术生成

展开全部

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace text

{

public class Score

{

public int GetMin(int[]list)

{

int min=int.MaxValue;

foreach(int i in list)

{

if(i<min)

min=i;

}

return min;

}

public int GetMax(int[]list)

{

int max=0;

foreach(int i in list)

{

if(i>max)

max=i;

}

return max;

}

public float GetAve(int[]list)

{

int sum=0;

float Ave;

foreach(int i in list)

{

sum+=i;

}

Ave=sum/10.0f;

return Ave;

}

}

class Program

{ <

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值