Let the mass of #Mg# in #36g# mixture be #xg# and the mass of Ca be #(36-x)g#
Considering atomic masses as follows
#Mg->24g"/mol"#
#Ca->40g"/mol"#
#Br->80g"/mol"#
Balanced equations of ractions are
#Mg+Br_2=MgBr_2......[1]#
#Ca+Br_2=CaBr_2........[2]#
As per equation [1]
#24g# Mg forms #184g# #MgBr_2#
#xg" "# Mg forms #(184x)/24g " "MgBr_2#
As per equation [2]
#40g# Ca forms #200g# #CaBr_2#
#(36-x)g" "# Ca forms #((36-x)200)/20g " "CaBr_2#
Hence by the given condition of the problem we can write
#184/24x+(36-x)200/40=212#
#=>23/3x+(180-5x)=212#
#=>23/3x-5x=212-180=32#
#=>(23x-15x)/3=32#
#=>(8x)/3=32#
#=>x=12#
So the mass of Mg is #12g#
and the mass of Ca is #(36-12)g=24g#
#% "of Mg"=12/36xx100%=33 1/3%#
#% "of Ca"=24/36xx100%=66 2/3%#