As one crest and one trough together make a wave.
40 crests and 40 troughs are equal to 40 waves.
The source produces 40 waves in 0.4 seconds.
So, Frequency=400.4=100 Hz.