Refactoring

This commit is contained in:
David Doblas Jiménez 2022-10-16 15:50:55 +02:00
parent 5442bbfd52
commit eaf103a283

View File

@ -26,14 +26,16 @@ function Problem19()
How many Sundays fell on the first of the month during the twentieth How many Sundays fell on the first of the month during the twentieth
century (1 Jan 1901 to 31 Dec 2000)? =# century (1 Jan 1901 to 31 Dec 2000)? =#
sundays = 0 sundays = 0
for y in 1901:2000 for year = 1901:2000
for m in 1:12 for month = 1:12
if Dates.dayofweek(Date(y, m, 1)) == Dates.Sunday if Dates.dayofweek(Date(year, month, 1)) == Dates.Sunday
sundays += 1 sundays += 1
end end
end end
end end
return sundays return sundays
end end