Good Night,
I have to get the biggest number on a list and I do not know how to get it, I'm using 2 for to get it but I keep the last major I can not get it. This is my code:
static int get(int[] a)
{
int sort = 0;
int sort2 = 0;
int mayor = 0;
List<int> a1 = new List<int>();
foreach (int test in a)
{
a1.Add(test);
}
int cont = a1.Count;
for (int i = 0; i < cont; i++)
{
for (int k = 0; k < cont; k++)
{
sort = a1[i];
sort2 = a1[k];
if (sort > sort2)
{
mayor = sort;
}
else
{
mayor = sort2;
}
}
}
return mayor;