Answer
$y=\dfrac{-1+\sin x}{x}$
Work Step by Step
The standard form of the given equation is:
$y'+(\dfrac{1}{x}) y=\dfrac{\cos x}{x}$ ....(1)
The integrating factor is: $e^{\int (\dfrac{1}{x}) dx}=x$
In order to determine the general solution, multiply equation (1) with the integrating factor and integrate both sides.
$\int [xy]' =\int \cos x dx $
or, $xy=\sin x+c$
Applying the initial conditions, we get $c=-1$
Thus, we have
$xy=\sin x-1$
Hence, $y=\dfrac{-1+\sin x}{x}$