This algorithm is has been solved by @moulds.
Click here to reveal the solution.

Whatever number you put in, the square of that number comes out.