Using reduction formula for $\sin(x)$ we have:
$$\int_{0}^{\frac{\pi}{2}}\sin^{n}\left(x\right)dx=\frac{n-1}{n}\int_{0}^{\frac{\pi}{2}}\sin^{\left(n-2\right)}\left(x\right)dx-\frac{\sin^{\left(n-1\right)}\left(x\right)\cos\left(x\right)}{n} \Bigg|_0^\frac{\large\pi}{2} $$
Now a simple comupation shows that:
$$\frac{\sin^{\left(k-1\right)}\left(x\right)\cos\left(x\right)}{k}\Bigg|_0^\frac{\large\pi}{2}=\left(\frac{\sin^{\left(k-1\right)}\left(\frac{\pi}{2}\right)\cos\left(\frac{\pi}{2}\right)}{k}\right)-\left(\frac{\sin^{\left(k-1\right)}\left(0\right)\cos\left(0\right)}{k}\right)=0$$
for $$k\ge2$$
Finally the least even power which the reduction is valid for is $k=2$ ,setting $k=2↦n$
and substituting for $n-1$,$n-2$,...,$2$ respectively we get the same result, so I will prevent to write it again and again.
Continuing this way we have:$$\frac{n-1}{n}\cdot\frac{n-3}{n-2}\cdot\frac{n-5}{n-4}...\left[\int_{0}^{\frac{\pi}{2}}\sin^{\left(2\right)}\left(x\right)dx\right]$$$$=\frac{n-1}{n}\cdot\frac{n-3}{n-2}\cdot\frac{n-5}{n-4}...\left[\frac{2-1}{2}\int_{0}^{\frac{\pi}{2}}\sin^{0}\left(x\right)dx\right]$$$$=\frac{n-1}{n}\cdot\frac{n-3}{n-2}\cdot\frac{n-5}{n-4}...\frac{2-1}{2}\left[x\right]\Bigg|_0^\frac{\large\pi}{2}=$$$$\boxed {\frac{n-1}{n}\cdot\frac{n-3}{n-2}\cdot\frac{n-5}{n-4}\cdot...\cdot\frac{3}{4}\cdot\frac{1}{2}\cdot\frac{\pi}{2}}$$ or $$\frac{\pi}{2}\prod_{k=1}^{\frac{n}{2}}\frac{2k-1}{2k}$$
So all we have to do is just a simple substitution.
for the case $n$ odd just let $k=3↦n$ , (clearly the least odd power is $3$) ,then we have:
$$\frac{n-1}{n}\cdot\frac{n-3}{n-2}\cdot\frac{n-5}{n-
4}\cdot\cdot\cdot\left[\int_{0}^{\frac{\pi}{2}}\sin^{5}\left(x\right)dx\right]$$$$=\frac{n-
1}{n}\cdot\frac{n-3}{n-2}\cdot\frac{n-5}{n-4}\cdot\cdot\cdot\left[\frac{5-
1}{5}\int_{0}^{\frac{\pi}{2}}\sin^{3}\left(x\right)dx\right]$$$$=\frac{n-1}{n}\cdot\frac{n-3}{n-
2}\cdot\frac{n-5}{n-4}\cdot\cdot\cdot\frac{5-1}{5}\cdot\left[\frac{3-
1}{3}\int_{0}^{\frac{\pi}{2}}\sin^{1}\left(x\right)dx\right]=$$$$\boxed{\frac{n-1}{n}\cdot\frac{n-3}{n-
2}\cdot\frac{n-5}{n-4}\cdot...\cdot\frac{4}{5}\cdot\frac{2}{3}\cdot1}$$ or $$\prod_{k=1}^{\frac{n-1}{2}}\frac{2k}{2k+1}$$
and the result follows.