Language: C++

using System;
using System.Collections.Generic;

namespace _0044
{
    class Program
    {
        static void Main(string[] args)
        {
            var primeList = new List<int>();
            for (int i = 1; i < 50022; i++)
            {
                if (IsPrime(i))
                {
                    primeList.Add(i);
                }
            }

            while (true)
            {
                var input = Console.ReadLine();

                if (string.IsNullOrEmpty(input)) { break; }

                var number = int.Parse(input);
                var previousPrimeNumber = 0;
                var nextPrimeNumber = 0;

                foreach (var primeNumber in primeList)
                {
                    if (primeNumber < number)
                    {
                        previousPrimeNumber = primeNumber;
                    }
                    else if (primeNumber > number)
                    {
                        nextPrimeNumber = primeNumber;
                    }

                    if (nextPrimeNumber != 0)
                    {
                        break;
                    }
                }
                Console.Write("{0} {1}\n", previousPrimeNumber, nextPrimeNumber);
            }
        }

        public static bool IsPrime(int number)
        {
            if (number <= 1)
            {
                return false;
            }
            else if (number <= 3)
            {
                return true;
            }
            else if ((number % 2) == 0)
            {
                return false;
            }
            else
            {
                for (int i = 3; i <= (int)Math.Sqrt(number); i += 2)
                {
                    if (number % i == 0)
                    {
                        return false;
                    }
                }
            }
            return true;
        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:8:26: error: 'string' has not been declared
    8 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:8:35: error: expected ',' or '...' before 'args'
    8 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:49:15: error: expected ':' before 'static'
   49 |         public static bool IsPrime(int number)
      |               ^~~~~~~
      |               :
a.cc:75:6: error: expected ';' after class definition
   75 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void _0044::Program::Main(int*)':
a.cc:10:13: error: 'var' was not declared in this scope
   10 |             var primeList = new List<int>();
      |             ^~~
a.cc:15:21: error: 'primeList' was not declared in this scope
   15 |                     primeList.Add(i);
      |                     ^~~~~~~~~
a.cc:21:21: error: expected ';' before 'input'
   21 |                 var input = Console.ReadLine();
      |                     ^~~~~
a.cc:23:21: error: 'string' was not declared in this scope
   23 |                 if (string.IsNullOrEmpty(input)) { break; }
      |                     ^~~~~~
a.cc:23:42: error: 'input' was not declared in this scope; did you mean 'int'?
   23 |                 if (string.IsNullOrEmpty(input)) { break; }
      |                                          ^~~~~
      |                                          int
a.cc:25:21: error: expected ';' before 'number'
   25 |                 var number = int.Parse(input);
      |                     ^~~~~~
a.cc:26:21: error: expected ';' before 'previousPrimeNumber'
   26 |                 var previousPrimeNumber = 0;
      |                     ^~~~~~~~~~~~~~~~~~~
a.cc:27:21: error: expected ';' before 'nextPrimeNumber'
   27 |                 var nextPrimeNumber = 0;
      |                     ^~~~~~~~~~~~~~~
a.cc:29:30: error: expected ')' before 'primeNumber'
   29 |                 foreach (var primeNumber in primeList)
      |                              ^~~~~~~~~~~
a.cc:29:25: note: to match this '('
   29 |                 foreach (var primeNumber in primeList)
      |                         ^
a.cc:29:17: error: 'foreach' was not declared in this scope
   29 |                 foreach (var primeNumber in primeList)
      |                 ^~~~~~~
a.cc:45:17: error: 'Console' was not declared in this scope
   45 |                 Console.Write("{0} {1}\n", previousPrimeNumber, nextPrimeNumber);
      |                 ^~~~~~~
a.cc:45:44: error: 'previousPrimeNumber' was not declared in this scope
   45 |                 Console.Write("{0} {1}\n", previousPrimeNumber, nextPrimeNumber);
      |                                            ^~~~~~~~~~~~~~~~~~~
a.cc:45:65: error: 'nextPrimeNumber' was not declared in this scope
   45 |                 Console.Write("{0} {1}\n", previousPrimeNumber, nextPrimeNumber);
      |                                                                 ^~~~~~~~~~~~~~~
a.cc: In static member function 'static bool _0044::Program::IsPrime(int)':
a.cc:65:43: error: 'Math' was not declared in this scope
   65 |                 for (int i = 3; i <= (int)Math.Sqrt(number); i += 2)
      |                                           ^~~~