using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string stringArrayLength;
            stringArrayLength = Console.ReadLine();
            long n = Int32.Parse(stringArrayLength);
            ///---- start
            long[] array = new long[n];
            array[0] = 2;
            int ii = 1;
            for (int i = 3; ii < n; i += 2)
            {
                double tof = Math.Floor(Math.Sqrt(i));
                bool test = true;
                for (int j = 0; array[j] <= tof /*&& test*/; j++)
                    if (i % array[j] == 0)
                        test = false;
                if (test)
                {
                    array[ii] = i;
                    ii++;
                }
            }
            ///---- end
            Console.WriteLine(array[array.Length - 1]);            
        }
    }
}

Add a code snippet to your website: www.paste.org