Doubt in Frequency Modulation code
When generating the sine wave, the code uses a sampling frequency to establish discrete points in the time domain. It is not continuous. This means the wave is broken up into bins that are exactly 1/fs in size/width.

So if you want a true integral of the wave, you have to take the average density of all the points in a bin by dividing by the sampling frequency.

Hope that helped.