<s>[INST] If y=y(x) and $\frac{2+sin(x)}{y+1}\frac{dy}{dx}=-cosx,y(0)=1$, then find $y(\frac{\pi}{2})$. Question:
If y=y(x) and $\frac{2+sin(x)}{y+1}\frac{dy}{dx}=-cosx,y(0)=1$, then find $y(\frac{\pi}{2})$.

My attempt:-
$$\frac{2+sin(x)}{y+1}\frac{dy}{dx}=-cosx$$
$$\frac{dy}{1+y}=-\frac{cos(x)}{2+sin(x)}dx$$
Integrating both sides
$$\int\frac{dy}{1+y}=-\int\frac{cos(x)}{2+sin(x)}dx$$
$$log(1+y)=-log(2+sin(x))+C$$
$$log(1+y)=log(\frac{1}{2+sin(x)})+C$$
Antilog on both sides
$$1+y=\frac{1}{2+sin(x)}+C$$
$$y=\frac{-1-sin(x)}{2+sin(x)}+C$$
Now it is given that $y(0)=1$
So $$y(0)=1=\frac{-1-sin(0)}{2+sin(0)}+C$$
$$1=\frac{-1}{2}+C$$
$$C=\frac{3}{2}$$
$$y(\frac{\pi}{2})=\frac{-1-sin(\frac{\pi}{2})}{2+sin(\frac{\pi}{2})}+C$$
$$y(\frac{\pi}{2})=\frac{-2}{3}+\frac{3}{2}$$
$$y(\frac{\pi}{2})=\frac{5}{6}$$
But the answer happens to be $\frac{1}{3}$.
 [/INST] You made a mistake by antiloging. The line $ 1+y=\frac{1}{2+\sin(x)}+C $ is wrong.
It would be easier if you would write $\log C$ instead $C$ in the line before. So in the next step you would get:
$$1+y=\frac{1}{2+\sin(x)} \cdot C$$
</s>