\(Mg+2HCl\rightarrow MgCl_2+H_2\)
\(2Al+6HCl\rightarrow2AlCl_3+3H_2\)
\(m_{tăng}=m_{hh}-m_{H_2}=7\left(g\right)\)
\(\Leftrightarrow m_{H_2}=7.8-7=0.8\left(g\right)\)
\(\Leftrightarrow n_{H_2}=\dfrac{0.8}{2}=0.4\left(mol\right)\)
\(n_{HCl}=2n_{H_2}=0.4\cdot2=0.8\left(mol\right)\)