RosettaCodeData/Task/Five-weekends/Run-BASIC/five-weekends.basic

27 lines
998 B
Plaintext

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