The month of October in 2010 has five Fridays, five Saturdays, and five Sundays.



Task

 Write a program to show all months that have this same characteristic of five full weekends from the year 1900 through 2100 (Gregorian calendar). 
 Show the number of months with this property (there should be 201).
 Show at least the first and last five dates, in order.

Algorithm suggestions

 Count the number of Fridays, Saturdays, and Sundays in every month.
 Find all of the 31-day months that begin on Friday.

Extra credit

Count and/or show all of the years which do not have at least one five-weekend month (there should be 29).



Related tasks
 Day of the week
 Last Friday of each month
 Find last sunday of each month


preYear = 1900
for yyyy      = 1900 to 2100           
   for mm     = 1 to 12                ' go thru all 12 months
      dayOne$ = mm;"-01-";yyyy         ' First day of month
      n       = date$(dayOne$)         ' Days since 1700
      dow     = 1 + (n mod 7)          ' Day of Week month begins
      m1      = mm                     '
      n1      = n + 27                 ' find end of month starting with 27th day
      while   m1 = mm                  ' if month changes we have the end of the month
         n1   = n1 + 1
         n$   = date$(n1)
         m1   = val(left$(n$,2))
      wend
      mmDays  = n1 - n                 ' Days in the Month
      if dow  = 4 and mmDays = 31 then ' test for 5 weeks
         count = count + 1
         print using("###",count);" ";yyyy;"-";left$("0";mm,2)
      end if
 
   next mm
   if preCount = count then 
     noCount = noCount + 1             ' count years that have none
     print yyyy;" has none ";noCount
   end if
   preCount = count
next yyyy