The number of risers is calculated by dividing the total rise by the maximum allowable riser height and rounding UP to the next whole number. This ensures the actual riser height is always equal to or less than the maximum code limit.