program tanggal;
uses wincrt;
type
x = array[1..7] of string [7];
const
faktorbl : array[1..12] of byte =(0,3,3,6,1,4,6,2,5,0,3,5);
days : x = ('minggu','senin','selasa','rabu','kamis','jumat','sabtu');
var
i : word;
nama : string[255];
j1,j2,j3,j4 : integer;
th, tg, bl : integer;
lagi : char;
begin
lagi:='Y';
while (lagi='Y') or (lagi='y') do
begin
clrscr;
write('tanggal ? ');readln(tg);
write('bulan(1-12) ? ');readln(bl);
write('tahun 20.. ? ');readln(th);
if th > 2012 then th := th - 2012;
j1 := trunc(th*365.25);
j2 := j1 + faktorbl[bl];
if (th/4 = int(th/4)) and (bl < 3) then j2 := j2-1;
j3 := j2 + tg;
j4 := trunc(frac(j3/7)*10);
writeln;
writeln('hari ini adalah hari ' ,days[j4]);
begin
writeln;
writeln('Anda ingin mengulang(Y/T)? ');
readln(lagi);clrscr;
end;
end;
end.
uses wincrt;
type
x = array[1..7] of string [7];
const
faktorbl : array[1..12] of byte =(0,3,3,6,1,4,6,2,5,0,3,5);
days : x = ('minggu','senin','selasa','rabu','kamis','jumat','sabtu');
var
i : word;
nama : string[255];
j1,j2,j3,j4 : integer;
th, tg, bl : integer;
lagi : char;
begin
lagi:='Y';
while (lagi='Y') or (lagi='y') do
begin
clrscr;
write('tanggal ? ');readln(tg);
write('bulan(1-12) ? ');readln(bl);
write('tahun 20.. ? ');readln(th);
if th > 2012 then th := th - 2012;
j1 := trunc(th*365.25);
j2 := j1 + faktorbl[bl];
if (th/4 = int(th/4)) and (bl < 3) then j2 := j2-1;
j3 := j2 + tg;
j4 := trunc(frac(j3/7)*10);
writeln;
writeln('hari ini adalah hari ' ,days[j4]);
begin
writeln;
writeln('Anda ingin mengulang(Y/T)? ');
readln(lagi);clrscr;
end;
end;
end.
Tidak ada komentar:
Posting Komentar