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.WriteLine("{0} {1}", previousPrimeNumber, nextPrimeNumber);
            }
        }

        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:73:6: error: expected ';' after class definition
   73 |     }
      |      ^
      |      ;
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:22:21: error: 'string' was not declared in this scope
   22 |                 if (string.IsNullOrEmpty(input)) { break; }
      |                     ^~~~~~
a.cc:22:42: error: 'input' was not declared in this scope; did you mean 'int'?
   22 |                 if (string.IsNullOrEmpty(input)) { break; }
      |                                          ^~~~~
      |                                          int
a.cc:23:30: error: expected primary-expression before 'int'
   23 |                 int number = int.Parse(input);
      |                              ^~~
a.cc:27:30: error: expected ')' before 'primeNumber'
   27 |                 foreach (var primeNumber in primeList)
      |                              ^~~~~~~~~~~
a.cc:27:25: note: to match this '('
   27 |                 foreach (var primeNumber in primeList)
      |                         ^
a.cc:27:17: error: 'foreach' was not declared in this scope
   27 |                 foreach (var primeNumber in primeList)
      |                 ^~~~~~~
a.cc:43:17: error: 'Console' was not declared in this scope
   43 |                 Console.WriteLine("{0} {1}", previousPrimeNumber, nextPrimeNumber);
      |                 ^~~~~~~
a.cc: In static member function 'static bool _0044::Program\U0000ff53::IsPrime(int)':
a.cc:63:43: error: 'Math' was not declared in this scope
   63 |                 for (int i = 3; i <= (int)Math.Sqrt(number); i += 2)
      |                                           ^~~~