Answer
\[y(x)=\frac{C-\ln |\cos x|}{\sin x}\]
Work Step by Step
$y'+y\cot x=\sec x$ _____(1)
(1) is Linear Differential Equation
Integrating factor-
\[I(x)=\large e^{\int \cot x dx}=\large e^{\ln|\sin x|}=\sin x\]
Multiply (1) by $I(x)$
\[\sin x\frac{dy}{dx}+y\cos x=\tan x\]
\[\frac{d}{dx}(y\sin x)=\tan x\]
Integrating,
\[y\sin x=\int \tan xdx+C\]
$C$ is constant of integration
\[y\sin x=C-\ln|\cos x|\]
\[y(x)=\frac{C-\ln|\cos x|}{\sin x }\]
Hence general solution of (1) is $y(x)=\Large\frac{C-\ln |\cos x|}{\sin x}$