Get largest element in array in C#
<p>I want to find the biggest element of an array.</p>
<h3>Code</h3>
<pre><code>static int FindBiggestElementInAnArray(int[] nums)
{
        int aaa = 0;
        for (int n = 0; n &lt; nums.Length; n++)
        {
            for (int a = 0; a &lt; nums.Length; a++)
            {
                if (nums[n] &gt;= nums[a])
                {
                    aaa++;
                    if (a == nums.Length - 1 &amp;&amp; aaa == nums.Length)
                    {
                       return n;
                    }
                }
            }
            aaa = 0;
        }
        return 0;
    }
    static void Main(string[] args)
    {
        int[] numbers = { 1, 3, 5, 3, 2, 7, 5, 9, 3, 34, 5 };
        Console.Write(FindBiggestElementInAnArray(numbers));
    }
</code></pre>
<p>I get <code>9</code>, but I expect to get <code>34</code>.</p>
<p>How do I resolve this issue?</p>