$\left(1+e^{\frac{x}{y}}\right) d x+e^{\frac{x}{y}}\left(1-\frac{x}{y}\right) d y=0$
$\left(1+e^{\frac{x}{y}}\right) d x+e^{\frac{x}{y}}\left(1-\frac{x}{y}\right) d y=0$
$\Rightarrow\left(1+e^{\frac{x}{y}}\right) d x=-e^{\frac{x}{y}}\left(1-\frac{x}{y}\right) d y$
$\Rightarrow \frac{d x}{d y}=\frac{-e^{\frac{x}{y}}\left(1-\frac{x}{y}\right)}{1+e^{\frac{x}{y}}}$ ...(1)
Let $F(x, y)=\frac{-e^{\frac{x}{y}}\left(1-\frac{x}{y}\right)}{1+e^{\frac{x}{y}}}$.
$\therefore F(\lambda x, \lambda y)=\frac{-e^{\frac{\lambda x}{\lambda y}}\left(1-\frac{\lambda x}{\lambda y}\right)}{1+e^{\frac{\lambda x}{\lambda y}}}=\frac{-e^{\frac{x}{y}}\left(1-\frac{x}{y}\right)}{1+e^{\frac{x}{y}}}=\lambda^{0} \cdot F(x, y)$
Therefore, the given differential equation is a homogeneous equation.
To solve it, we make the substitution as:
x = vy
$\Rightarrow \frac{d}{d y}(x)=\frac{d}{d y}(v y)$
$\Rightarrow \frac{d x}{d y}=v+y \frac{d v}{d y}$
Substituting the values of $x$ and $\frac{d x}{d y}$ in equation (1), we get:
$v+y \frac{d v}{d y}=\frac{-e^{v}(1-v)}{1+e^{v}}$
$\Rightarrow y \frac{d v}{d y}=\frac{-e^{v}+v e^{v}}{1+e^{v}}-v$
$\Rightarrow y \frac{d v}{d y}=\frac{-e^{v}+v e^{v}-v-v e^{v}}{1+e^{v}}$
$\Rightarrow y \frac{d v}{d y}=-\left[\frac{v+e^{v}}{1+e^{v}}\right]$
$\Rightarrow\left[\frac{1+e^{v}}{v+e^{v}}\right] d v=-\frac{d y}{y}$
Integrating both sides, we get:
$\Rightarrow \log \left(v+e^{v}\right)=-\log y+\log \mathrm{C}=\log \left(\frac{\mathrm{C}}{y}\right)$
$\Rightarrow\left[\frac{x}{y}+e^{\frac{x}{y}}\right]=\frac{\mathrm{C}}{y}$
$\Rightarrow x+y e^{\frac{x}{y}}=\mathrm{C}$
This is the required solution of the given differential equation.