If you are given a real number, indeed the rationals "closest to it" on both the left and right will exist, and they will be very easy to find.
For example, let us consider $n=10$ and the real number $\pi$. We want to find the closest rationals to $\pi$ with denominator less than $10$. For this, we do something very simple : calculate the lcm of $1,...,10$ : this is $2520$. Now, multiply $\pi$ by $2520$ up to some decimal places : you would get $7916.81$. Hence, you conclude that $\frac{7916}{2520} < \pi < \frac{7917}{2520}$.
Now, what you are going to do is very simple : find the biggest number less than $7916$ which is a multiple of any one of the following : $$
2520,1260,840,630,504,420,360,315,280,252
$$
These are the quotients when $2520$ is divided by $1,...,10$ respectively. I found it : it is $7875 = 315 \times 25$. Hence, $\frac{7875}{2520} = \frac{25}{8}$ is the closest fraction to $\pi$ with denominator less than $10$, from the left.
From the right, we must find the smallest multiple of one of these numbers, which is greater than $7917$. Again, you can locate this : it is just $7920= 22
\times 360$. This simplifies to the popular fraction $\frac{7920}{2520} = \frac{22}{7}$.
Hence, $\frac{25}{8} < \pi < \frac{22}{7}$ are the best approximations you will get with denominator less than $10$. It's not difficult to see that there was anything special about $\pi$ or $10$ here.
This is not the efficient way to do this, but at least existence of rationals satisfying the above criteria is now put to bed.