The two-dimensional moment problem consists of finding a non-negative Borel measure in such that
where is prescribed sequence of complex numbers. The author obtains an algorithm to solve the two-dimensional moment problem. The algorithm gives the necessary and sufficient conditions for the solvability of the moment problem. In addition, analogous results are obtained for the complex moment problem.