Check the picture below.
[tex]\bf \textit{sum of all exterior angles in a polygon}\\\\ n\theta = 360~~ \begin{cases} n=\stackrel{number~of}{sides}\\ \theta =angle~in\\ \qquad degrees\\[-0.5em] \hrulefill\\ 0=45 \end{cases}\implies n(45)=360\implies n=\cfrac{360}{45}\implies \stackrel{\textit{an octagon}}{n=8}[/tex]