Hi, I am trying to find the minimum number in an array. I am supposed to get 1, but I am getting 3. I would just need someone to point out what am I missing and I will try to take it from there.
C#:
int[] Array1 = new int[] { 25, 1, 30, 1, 3 }; bool set_condition;
int num = 0;
for(int i = 0; i<Array1.Length; i++)
{
for(int j = 0; j<Array1.Length; j++)
{
if (i != j)
{
if (Array1[i] <= Array1[j])
{
Console.WriteLine("Array1[{0}] and Array1[{1}],{2},{3} = True ", i, j,Array1[i],Array1[j]);
set_condition = true;
num = Array1[i];
}
else
{
Console.WriteLine("Array1[{0}] and Array1[{1}],{2},{3} = False ", i, j, Array1[i], Array1[j]);
set_condition = false;
break;
}
}
}
}
Console.WriteLine(num);
}