1个回答
展开全部
program YMDToW;
var
y, m, d, w: Integer;
begin
Write('year: '); Readln(y);
Write('month: '); Readln(m);
Write('day: '); Readln(d);
if m < 3 then
begin
m := m + 12;
y := y - 1;
end;
w := y + y div 4 + y div 400 - y div 50 +
26 * (m + 1) div 10 + d - 1;
Writeln('Day of week: ', w mod 7);
end
var
y, m, d, w: Integer;
begin
Write('year: '); Readln(y);
Write('month: '); Readln(m);
Write('day: '); Readln(d);
if m < 3 then
begin
m := m + 12;
y := y - 1;
end;
w := y + y div 4 + y div 400 - y div 50 +
26 * (m + 1) div 10 + d - 1;
Writeln('Day of week: ', w mod 7);
end
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询