Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program piatek_13;
- uses
- crt;
- function dzien_tygodnia(dzien, miesiac, rok : integer) : integer; //zmieniony algorytm Horzyka
- var
- n, t : integer;
- begin
- if (dzien > 0) and (dzien < 32) and (miesiac > 0) and (miesiac < 13)
- and (rok > 1900) and (rok < 2100) then
- begin
- n := 6 + dzien + rok - 1990 + ((rok - 1990) div 4);
- case miesiac of
- 4,7 : ;
- 1,10 : n:=n+1;
- 5 : n:=n+2;
- 8 : n:=n+3;
- 2,3,11 : n:=n+4;
- 6 : n:=n+5;
- 9,12 : n:=n+6
- end;
- if ((rok mod 4) = 0) and (miesiac<3) then n:=n-1;
- t := n mod 7;
- dzien_tygodnia := t
- end
- else dzien_tygodnia := 0
- end;
- var
- i, j, year, month, day, tmp : integer;
- begin
- writeln('Podaj dzien');
- readln(day);
- writeln('Podaj miesiac');
- readln(month);
- writeln('Podaj rok');
- readln(year);
- writeln(dzien_tygodnia(day, month, year));
- day:=13;
- for i:=2010 to 2015 do
- for j:=1 to 12 do
- begin
- tmp:=dzien_tygodnia(day, j, i);
- if tmp = 5 then
- writeln(day, ' ', j, ' ', i)
- end;
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment