finish algorithm to print code