Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program bt;
- Uses Crt;
- var ngay, thang, nam:integer;
- namnhuan:Boolean;
- Begin
- Clrscr;
- write('Nhap ngay, thang, nam:=');
- readln(ngay,thang,nam);
- If ((nam MOD 400=0) or ((nam mod 4=0) and (nam mod 100<>0)))
- then (namnhuan):=True
- else namnhuan:=False;
- Case thang OF
- 1,3,5,7,8,10,12:if ngay=31 then
- begin
- ngay:=1;
- thang:=thang+1;
- end
- else inc(ngay);
- 2: If (namnhuan) then
- begin
- if ngay=29 then
- begin
- ngay:=1;
- thang:=3;
- end else inc(ngay);
- end
- else if (ngay=28) then
- begin
- ngay:=1;
- thang:=3;
- end else inc(ngay);
- 4,6,9,11: if(ngay=30) then
- begin
- ngay:=1;
- inc(thang);
- end
- else inc(ngay);
- end;
- If thang > 12 then
- begin
- nam:=nam+1;
- thang:=1;
- end;
- writeln('Ngay hom sau la: ',ngay,' ', thang,' ', nam);
- readln;
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement