Consider this. Every plant makes 90% of its mass from the air, while 6% is extracted from water. Only 4% of its mass is made from the soil.
- Oxygen(45%), Carbon(45%) -- extracted from carbon dioxide in the air.
- Hydrogen(6%) -- extracted from water absorbed via roots and leaves (the oxygen component in water is released back into atmosphere).
- Soil nutrients (4%) -- nitrogen, potassium, etc. extracted via soil microbes.
That is, excluding the water mass present in the plant. Because the major compound in all plants is water. After the water is removed, the bulk of the dry plant material consists of carbohydrate compounds containing the elements carbon, hydrogen, and oxygen. And, about 90% of the weight of those carbohydrates is carbon and oxygen.