1. By treating hydrochloric acid with sodium nitrite,
2. Methyl amine reacts with nitrous acid to form methyldiazonium salt which being unstable, liberates nitrogen gas quantitatively and forms methanol.

Aniline reacts with nitrous acid at low temperature (273-278 K) to form benzenediazonium salt, a very important compound used in synthetic organic chemistry.
