[tex]\bf \textit{volume of a cylinder}=V_c=\pi r^2 h\qquad
\begin{cases}
r=radius=\frac{diameter}{2}\\
h=height\\
----------\\
diameter=8\\
radius=\frac{diameter}{2}=4
\end{cases}
\\\\\\
V_c=\boxed{\pi 4^2 h}
\\\\\\
\textit{volume of a rectangular prism}=V_p=lwh\qquad
\begin{cases}
l=length\\
h=height\\
w=width\\
-------\\
length=x\\
width=x
\end{cases}
\\\\\\
V_p=xxh\implies V_p=\boxed{x^2h}\\\\
[/tex]
[tex]\bf -----------------------------\\\\
\textit{now, we know that their volumes and height are equal}
\\\\\\
thus
\\\\\\
\pi 4^2 h=x^2h[/tex]
solve for "x"