When a bright fringe is formed opposite to one of the slits, $x = \frac{d}{2}$
Path difference $ = \frac{xd}{D} $
$= \frac{d}{2} \times \frac{d}{D} = \frac{d^2}{2D}$
If it is $n^{th}$ order bright fringe,
Path differnce, $n\lambda = \frac{d^2}{2D}$ or $ n = \frac{d^2}{2D\lambda}$