Answer
$C=y^2x+\sin x-\cos y$
Work Step by Step
We are given:
$$(y^2+\cos x)dx+(2xy+\sin y)dy=0 (1)$$
Here,
$M(x,y)=\frac{\partial}{\partial y}(y^2+\cos x)=2y$
$N(x,y)=\frac{\partial}{\partial x}(2xy+\sin y)=2y$
$M_y=2y\;\;\;\;,\;\;\;\;N_x=2y$
$M_y=N_x$
$\Rightarrow$ (1) is exact differential equation
Therefore there exists a potential function $\phi$ such that
$\frac{\partial\phi}{\partial x}=y^2+\cos x$ ___(2)
Integrating (2) with respect to $x$ holding $y$ fixed
$\phi =y^2x+\sin x+f(y)$ ___(3)
Where $f(y)$ is arbitrary function of $y$
Hence we get:
$\frac{\partial\phi}{\partial y}=2yx+f'(y)=2xy+\sin y$ (4)
We have
$f'(y)= \sin y \rightarrow f(y)=-\cos y +C$
$C$ is constant
The solution is:
$\phi(x,y)=y^2x+\sin x-\cos y+C$
and $\phi(x,y)=0$
so:
$C=y^2x+\sin x-\cos y$