The mass number of an atom represents the total number of protons and neutrons in its nucleus. Since protons and neutrons have nearly equal masses and their masses are approximately equal to 1 atomic mass unit (amu), the mass number is typically a whole number. For example, if an atom has 8 protons and 8 neutrons, the mass number would be 16.
On the other hand, the atomic mass or atomic weight of an element is a weighted average of the masses of all the isotopes of that element found in nature. Isotopes are atoms of the same element that have different numbers of neutrons in their nuclei. These isotopes can exist in different proportions, and their masses are not necessarily whole numbers.
When calculating the atomic mass of an element, each isotope's mass is multiplied by its relative abundance, and the values are summed. Since the abundance of each isotope is expressed as a decimal or fraction, the resulting atomic mass is often a fractional value. This fractional atomic mass reflects the average mass of all the isotopes of an element, taking into account their relative proportions.
So, while the mass number is a whole number because it represents the total number of protons and neutrons, the atomic mass is fractional because it represents the weighted average of the masses of different isotopes, considering their abundance.