Concept:
This is a first-order separable differential equation. In such equations, all terms involving \(y\) are collected on one side and all terms involving \(x\) are collected on the other side.
After separation, both sides are integrated independently.
Step 1: Rewriting the differential equation.
Given:
\[
(2+\sin x)\frac{dy}{dx}+(y+1)\cos x=0
\]
Move the second term to the RHS:
\[
(2+\sin x)\frac{dy}{dx}=-(y+1)\cos x
\]
Divide both sides by
\[
(y+1)(2+\sin x):
\]
\[
\frac{1}{y+1}\frac{dy}{dx}
=
-\frac{\cos x}{2+\sin x}
\]
Multiplying by \(dx\):
\[
\frac{1}{y+1}\,dy
=
-\frac{\cos x}{2+\sin x}\,dx
\]
Step 2: Integrating both sides.
Integrating:
\[
\int \frac{1}{y+1}\,dy
=
-\int \frac{\cos x}{2+\sin x}\,dx
\]
Left side:
\[
\int \frac{1}{y+1}\,dy
=
\ln|y+1|
\]
For the RHS, let:
\[
u=2+\sin x
\]
Then:
\[
du=\cos x\,dx
\]
Hence,
\[
-\int \frac{\cos x}{2+\sin x}\,dx
=
-\int \frac{du}{u}
=
-\ln|u|
\]
Substituting back:
\[
-\ln|2+\sin x|
\]
Thus,
\[
\ln|y+1|
=
-\ln|2+\sin x|+C
\]
Step 3: Combining logarithms.
Using logarithmic properties:
\[
\ln|y+1|+\ln|2+\sin x|=C
\]
\[
\ln|(y+1)(2+\sin x)|=C
\]
Exponentiating both sides:
\[
(y+1)(2+\sin x)=K
\]
where \(K\) is a constant.
Step 4: Using the initial condition.
Given:
\[
y(0)=1
\]
Substitute \(x=0,\ y=1\):
\[
(1+1)(2+\sin0)=K
\]
Since \(\sin0=0\):
\[
2(2)=K
\]
\[
K=4
\]
Therefore,
\[
(y+1)(2+\sin x)=4
\]
Step 5: Finding \(y\left(\frac{\pi}{2}\right)\).
Substitute:
\[
x=\frac{\pi}{2}
\]
Since:
\[
\sin\frac{\pi}{2}=1,
\]
we get:
\[
(y+1)(2+1)=4
\]
\[
3(y+1)=4
\]
\[
y+1=\frac43
\]
\[
y=\frac43-1
\]
\[
y=\frac13
\]
Hence,
\[
\boxed{
y\left(\frac{\pi}{2}\right)=\frac13
}
\]