Day of the week of Christmas and New Year: Difference between revisions

Add PL/I
(Add Cowgol)
(Add PL/I)
Line 504:
In 2393, New year's day is on a Friday, and Christmas day on a Saturday.
</pre>
 
=={{header|PL/I}}==
<lang pli>xmas_and_newyear: procedure options(main);
day_name: procedure(year,month,day) returns(char(9) varying);
declare days(0:6) char(9) varying;
declare (year, month, day) fixed;
declare (y, m, d, j, k) fixed;
days(0) = 'Saturday';
days(1) = 'Sunday';
days(2) = 'Monday';
days(3) = 'Tuesday';
days(4) = 'Wednesday';
days(5) = 'Thursday';
days(6) = 'Friday';
m = month;
y = year;
if m <= 2 then do;
m = m + 12;
y = y -1;
end;
j = y/100;
k = mod(y,100);
d = mod((day + ((m+1)*26)/10 + k + k/4 + j/4 + 5*j),7);
return(days(d));
end day_name;
declare years(2) fixed static initial(2021, 2022);
declare months(2) fixed static initial( 12, 1);
declare days(2) fixed static initial( 25, 1);
declare i fixed;
do i=1 to 2;
put skip edit(months(i),'/',days(i),'/',years(i),
' is a ',
day_name(years(i),months(i),days(i)))
(F(2),A,F(2),A,F(4),A,A);
end;
end xmas_and_newyear;</lang>
{{out}}
<pre>12/25/2021 is a Saturday
1/ 1/2022 is a Saturday</pre>
 
=={{header|Python}}==
2,114

edits