\(n_{Mg}=a\left(mol\right),n_{Al}=b\left(mol\right)\)
\(m=24a+56b=5.1\left(g\right)\left(1\right)\)
\(n_{H_2}=\dfrac{5.6}{22.4}=0.25\left(mol\right)\)
\(Mg+2HCl\rightarrow MgCl_2+H_2\)
\(2Al+6HCl\rightarrow2AlCl_3+3H_2\)
\(n_{H_2}=a+1.5b=0.25\left(mol\right)\left(2\right)\)
\(\left(1\right),\left(2\right):a=b=0.1\)
\(\%Mg=\dfrac{0.1\cdot24}{5.1}\cdot100\%=47.06\%\)
\(\%Al=100-47.06=52.94\%\)
Chúc em học tốt nhé !