2つの年月日の間の日数を求めるプログラム(PASCAL)
大学の講義で、「2つの年月日を入力し、その年月日の間の日数を求めるプログラムを作成しなさい」という宿題が出たので、下のようにプログラムを作成したところ、…63(最後の行):parse error before '.'というエラーが出たのですが、なぜそのようなエラーが出るのかがわかりません。どう改善すべきか、アドバイスをお願いします。
program ex13(input,output);
var
year1,year2:1..9999; month1,month2:1..12;
y1,y2:1..9999; m1,m2:1..12; d1,d2:1..31;
n1,n2:1..9999999;
begin
writeln('question 13');
writeln('Please key the old date.');
write('Y: '); read(y1);
write(' M: '); read(m1);
write(' D: '); readln(d1);
writeln('Please key the new date.');
write('Y: '); read(y2);
write(' M: '); read(m2);
write(' D: '); readln(d2);
for year1:= 1 to y1 do
begin
if ((year1 mod 4 = 0) and not (year1 mod 100 = 0)) or (year1 mod 400 = 0)
then n1:=n1+366
else n1:=n1+365
end;
for month1:= 1 to m1 do
begin
case month1 of
3,5,7,8,10,12,1: n1:=n1+31;
4,6,9,11: n1:=n1+30;
2: if ((y1 mod 4 = 0) and not (y1 mod 100 = 0)) or (y1 mod 400 = 0)
then n1:=n1+29
else n1:=n1+28
end;
n1:=n1+d1;
for year2:= 1 to y2 do
begin
if ((year2 mod 4 = 0) and not (year2 mod 100 = 0)) or (year2 mod 400 = 0)
then n2:=n2+366
else n2:=n2+365
end;
for month2:= 1 to m2 do
begin
case month2 of
3,5,7,8,10,12,1: n2:=n2+31;
4,6,9,11: n2:=n2+30;
2: if ((y2 mod 4 = 0) and not (y2 mod 100 = 0)) or (y2 mod 400 = 0)
then n2:=n2+29
else n2:=n2+28
end;
n2:=n2+d2;
writeln('Ans.',n2-n1);
end.