Lent is six weeks. We prepare for Easter by praying, fasting, abstaining, cleansing ourselves for the coming of Jesus.
Remove the six sundays, and its 40. So, sundays are not counted because they are considered days of celebration.
References:
I wonder whats special with the number 40? It came out several times in the bible, starting from the 40days and 40 nights of Noah.