\begin{algorithmic}
        \STATE $term = 1$
        \STATE $y = 0$
        \FOR {$i = 0$ \TO $n$}
            \STATE $y = y + a_i \cdot term$
            \STATE $term = term \cdot x$
        \ENDFOR
        \end{algorithmic}