Answer
$f(x,y)=ye^x+x\sin y+k$
Work Step by Step
When $F(x,y)=Ai+Bj$ is a conservative field, then throughout the domain $D$, we get
$\dfrac{\partial A}{\partial y}=\dfrac{\partial B}{\partial x}$
$a$ and $b$ are the first-order partial derivatives on the domain $D$.
Here, we have $\dfrac{\partial A}{\partial y} = \dfrac{\partial B}{\partial x}=e^x +\cos y$
Thus, the vector field $F$ is conservative.
Now, $f(x,y)=ye^x+x\sin y+g(y)$ [g(y) : A function of y]
$f_y(x,y)=e^x+x\cos y+g'(y)$
Here, $g(y)=k$
Hence, $f(x,y)=ye^x+x\sin y+k$