There is a polygon in 2D space. Find its area : <p>There is a polygon in 2D space. Find its area. 
An array of numbers:</p>

<ol>
<li><p>Positive integer n, the quantity of the polygon vertices.</p></li>
<li><p>Sequence of reals with n subsequences of two numbers, each subsequence contains the 2D coordinates of a vertex of the polygon.
Output:</p></li>
</ol>

<p>A real, the area of the polygon</p>

<p>What is wrong with my code? </p>

<p>Example: </p>

<p>Input:
3 1.0 0.0 0.0 2.0 -1.0 0.0 
Output:
2</p>

<p>class Program
    {</p>

<pre><code>    static void Main(string[] args)
    {
        var input = Console.ReadLine();

        var numbers = input.Split(' ').Select(x =&gt; double.Parse(x)).ToArray();

        var a = (int) numbers[0];

        double[] arr = numbers.Skip(1).Take(a).ToArray();

        double[,] coord = new double[2, a];

        for(int i = 0; i &lt;= arr.Length/2; i++)
        {
            coord[0, i] = arr[i];
            coord[1, i] = arr[1+i];
        }

        double sum1 = 0;
        double sum2 = 0;

        for(int i = 0; i &lt; a - 1; i++)
        {
            sum1 += coord[0, i] * coord[1, i + 1];
            sum2 += coord[1, i] * coord[0, i + 1];
        }

        double area = Math.Abs((sum1 - sum2) / 2d);

        Console.Write(coord[0,2]);
        Console.ReadKey(); 

    }



}
</code></pre>
