If p,T,ρ and R represents pressure, temperature, density and universal gas constant then ideal gas equation pV=nRT for n mole of gas
pV = RT for 1 mole of gas
We know that M=V×ρ⇒V=ρM
Put the value of V in gas equation p×ρM=RT
then molar mass of gas M=pρRT