VAR bool,bool2:boolean; begin readln(day,month,year); case month of 1,3,5,7,8,10,12: if (day<32) and (day>0) then bool:=true else bool:=false; 4,6,9,11:if (day<31) and (day>0) then bool:=true else bool:=false; 2:if ((day<29) and (day>0)) or ((year mod 4=0) and (day>0) and (day30)) then bool:=true else bool:=false; end; if bool then begin writeln('correct Date') case month of 1,3,5,7,8,10,12: if day=31 then bool2:=true else bool2:=false; 4,6,9,11:if day=30 then bool2:=true else bool2:=false; 2:if ((year mod 4<>0) and (day=28)) or ((year mod 4=0) and (day=29)) then bool2:=true else bool2:=false; if bool2 then if month=12 then writeln('1','1',year+1) else writeln('1',month+1,year) else writeln(day+1,month,year); end else writeln('Date incorrect !'); end.
|