本文實(shí)例講述了C#實(shí)現(xiàn)輸入10個(gè)數(shù)存入到數(shù)組中并求max和min及平均數(shù)的方法。分享給大家供大家參考,具體如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int nu1, max,min,number;
int[] str = new int[10];
for (nu1 = 0; nu1<10; nu1++)
str[nu1] = Int32.Parse(Console.ReadLine());
max = str[0];
min = str[1];
number = 0;
for (nu1 = 0; nu1 < 10; nu1++)
{
number += str[nu1];
if (str[nu1] > max)
max = str[nu1];
if (str[nu1] < min)
min = str[nu1];
}
number /= 10;
Console.WriteLine("max is :{0}",max);
Console.WriteLine("min is :{0}", min);
Console.WriteLine("pingjun is :{0}", number);
Console.ReadKey();
}
}
}
PS:這里再為大家推薦幾款計(jì)算工具供大家進(jìn)一步參考借鑒:
在線一元函數(shù)(方程)求解計(jì)算工具:
http://tools.html5code.net/jisuanqi/equ_jisuanqi
科學(xué)計(jì)算器在線使用_高級計(jì)算器在線計(jì)算:
http://tools.html5code.net/jisuanqi/jsqkexue
在線計(jì)算器_標(biāo)準(zhǔn)計(jì)算器:
http://tools.html5code.net/jisuanqi/jsq
更多關(guān)于C#相關(guān)內(nèi)容還可查看本站專題:《C#字符串操作技巧總結(jié)》、《C#數(shù)據(jù)結(jié)構(gòu)與算法教程》、《C#常見控件用法教程》、《WinForm控件用法總結(jié)》、《C#程序設(shè)計(jì)之線程使用技巧總結(jié)》、《C#數(shù)組操作技巧總結(jié)》及《C#面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程》
希望本文所述對大家C#程序設(shè)計(jì)有所幫助。
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!