Language: C++

using System;
using System.Collections.Generic;

namespace _0044
{
    class Programｓ
    {
        static void Main(string[] args)
        {
            List<int> 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; }

                int number = int.Parse(input);
                int previousPrimeNumber = 0;
                int 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:48:15: error: expected ':' before 'static'
   48 |         public static bool IsPrime(int number)
      |               ^~~~~~~
      |               :
a.cc:74:6: error: expected ';' after class definition
   74 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void _0044::Program\U0000ff53::Main(int*)':
a.cc:10:13: error: 'List' was not declared in this scope
   10 |             List<int> primeList = new List<int>();
      |             ^~~~
a.cc:10:18: error: expected primary-expression before 'int'
   10 |             List<int> primeList = new List<int>();
      |                  ^~~
a.cc:15:21: error: 'primeList' was not declared in this scope
   15 |                     primeList.Add(i);
      |                     ^~~~~~~~~
a.cc:21:17: error: 'var' was not declared in this scope
   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:30: error: expected primary-expression before 'int'
   25 |                 int number = int.Parse(input);
      |                              ^~~
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: In static member function 'static bool _0044::Program\U0000ff53::IsPrime(int)':
a.cc:64:43: error: 'Math' was not declared in this scope
   64 |                 for (int i = 3; i <= (int)Math.Sqrt(number); i += 2)
      |                                           ^~~~