我被困在从数组中获取最小值。每次运行时,最小值仍然为零。我知道索引必须减一,但我只是不知道我应该如何将它应用于代码。对不起我的英语不好,我希望你们能帮助我!
public partial class Form1 : Form
{
int[] numbers = new int[99];
int index = 0;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public int Som()
{
//if the numbers are <99 they will be add to index.
int som = 0;
for (int i = 0; i < 99; i++)
{
som = som + numbers[i];
}
return som;
}
public int Average()
{
//
int answersom = Som();
int g = …Run Code Online (Sandbox Code Playgroud)