Answer
$\tan y=-\cos x-x \sin x+c$
Work Step by Step
In order to to solve the given differential equation we will have to separate the variables and then integrate.
Here, we have
$\sec x dy+x \cos^2 y dx=0$
or, $\int \dfrac{dy}{\cos^2 y}=-\int \dfrac{x}{\sec x} dx$
or, $x \sin x-\int (-\sin x) dx =\tan y$
Then, we have $ -[x \cos x+\cos x +c]=\tan y$
Hence, $\tan y=-\cos x-x \sin x+c$