How do nonmetals react with acids?
There is no general reaction like many metals displacing hydrogen. But some reactions can occur with specific nonmetals and acids. See the explanation for a couple examples.
Nitric acid, a strongly oxidizing acid, will oxidize carbon to carbon dioxide. It will oxidize sulfur and phoshorous too, forming sulfuric and phosphoric acids.
At the other extreme, hydrobromic (HBr) and hydriodic (HI) acids have reducing properties. Chlorine will form hydrochloric acid with either HBr or HI, displacing the heavier halogen.