The atomic mass of an element is not always a whole number because it takes into account the relative abundance of different isotopes of that element. Isotopes are variants of an element that have the same number of protons but different numbers of neutrons in their nuclei.
Isotopes of an element have different masses due to the varying number of neutrons. Since isotopes occur naturally in different proportions, the atomic mass is a weighted average of the masses of all the naturally occurring isotopes of an element. The atomic mass is calculated by multiplying the mass of each isotope by its relative abundance and summing up these contributions.
For example, carbon has three naturally occurring isotopes: carbon-12, carbon-13, and carbon-14. Carbon-12 is the most abundant isotope, followed by carbon-13 and carbon-14. The atomic mass of carbon is calculated by considering the mass and abundance of each isotope, resulting in an atomic mass of approximately 12.01 atomic mass units (u).
Since the atomic mass accounts for the isotopic composition and abundance, it is often not a whole number but can have decimal values. These decimal values reflect the weighted average of the different isotopes' masses, considering their relative abundances.