The mass of an atom is primarily due to the protons and neutrons in the nucleus. Protons and neutrons are both baryons, which are subatomic particles that make up matter. Each proton has a mass of approximately 1 atomic mass unit (amu), and each neutron has a mass of approximately 1 amu. Electrons, on the other hand, have a much smaller mass, with each electron contributing only about 1/1836 amu to the overall mass of an atom.
The total mass of an atom can be calculated by adding the masses of all its protons and neutrons. For example, the mass of a carbon-12 atom is approximately 12 amu because it has six protons and six neutrons.
The arrangement of the protons, neutrons, and electrons within an atom determines the atom's properties and behavior. The number of protons in the nucleus defines the element, while the number of electrons in the electron cloud determines the atom's chemical reactions and interactions with other atoms.