The easy answer is the generalized continued fraction
$$ x =\sqrt n \\x^2-k^2 = n -k^2 \ \ where \ k \in \mathbb{N},\ k^2 \simeq n\\ (x+k)(x-k)= n-k^2 \\x-k =(n-k^2)/(k+x)\\ x = k+(n-k^2)/(k+x)
\\x= k+(n-k^2)/(k+k+(n-k^2)/(k+x))\\x=k+(n-k^2)/(2k+(n-k^2)/(2k+(n-k^2)/2k+...$$
As an example, take n=7, k=2 $ \sqrt 7 = 2+3/(4+3/(4+...$
The simple continued fraction (one in which the denominators are all equal to 1) of the square root of an integer is somewhat harder to compute.The terms of the simple continued fraction for the square root of any integer will have repeating terms. The repeated terms will form a palindrome (same forwards as backward). The last value in the repeated sequence is always twice the initial (integer value of root) term.
Euler showed that any periodic continued fraction was a quadratic irrational number and in 1770 Lagrange proved the converse. Therefore the solution to any quadratic equation can be represented as a unique repeating simple continued fraction and for any repeating simple continued fraction one can find the quadratic surd [ ( $a+b \sqrt c)/d$ ] associated with that value.
Here are the simple fraction repeats of roots of some integers
$$
\sqrt { 2 } = 1+1/(2+1/(2+1/(2+1/(2+1/(2+1/(2+1/(2+1/(2+ ... \\ = ([1, 2], 1) \\
\sqrt { 3 } = 1+1/(1+1/(2+1/(1+1/(2+1/(1+1/(2+1/(1+1/(2+ ... \\ = ([1, 1, 2], 2) \\
\sqrt { 5 } = 2+1/(4+1/(4+1/(4+1/(4+1/(4+1/(4+1/(4+1/(4+ ... \\ = ([2, 4], 1) \\
\sqrt { 6 } = 2+1/(2+1/(4+1/(2+1/(4+1/(2+1/(4+1/(2+1/(4+ ... \\ = ([2, 2, 4], 2) \\
\sqrt { 7 } = 2+1/(1+1/(1+1/(1+1/(4+1/(1+1/(1+1/(1+1/(4+ ... \\ = ([2, 1, 1, 1, 4], 4) \\
\sqrt { 8 } = 2+1/(1+1/(4+1/(1+1/(4+1/(1+1/(4+1/(1+1/(4+ ... \\ = ([2, 1, 4], 2) \\
\sqrt { 10 } = 3+1/(6+1/(6+1/(6+1/(6+1/(6+1/(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