From eaf103a28360e4b503ab5066ea90cb5eab64c10a Mon Sep 17 00:00:00 2001 From: daviddoji Date: Sun, 16 Oct 2022 15:50:55 +0200 Subject: [PATCH] Refactoring --- src/Julia/Problems001-050/Problem019.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Julia/Problems001-050/Problem019.jl b/src/Julia/Problems001-050/Problem019.jl index 976594e..9b0f209 100644 --- a/src/Julia/Problems001-050/Problem019.jl +++ b/src/Julia/Problems001-050/Problem019.jl @@ -26,14 +26,16 @@ function Problem19() How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)? =# + sundays = 0 - for y in 1901:2000 - for m in 1:12 - if Dates.dayofweek(Date(y, m, 1)) == Dates.Sunday + for year = 1901:2000 + for month = 1:12 + if Dates.dayofweek(Date(year, month, 1)) == Dates.Sunday sundays += 1 end end end + return sundays end