This is value known as specific heat capacity at constant volume, or CV. You obtain said quantity by counting degrees of freedom and dividing it by 2. For diatomic gas, there are 7 total, 3 translational, 2 vibrational, and 2 rotational, but the 2 vibrational degrees of freedom are typically "frozen out". So you only count the 5. That gives you the 5/2. For monatomic gas, there are only the translational, so you get 3/2.
Realistically, the value will be off by a bit. There is an associated quantity γ=CP/CV known as heat capacity ratio. You can look it up for gas of interest, and use the fact that CP=CV+1 to compute the actual ratio.
Note that all these values are in units of R. So the actual specific heat capacity of diatomic gas at constant volume will be 5/2R per mole of gas.