tugas 3 (if, case of, procedure, repeat until, while do, for to do)

program konjungsi;
uses wincrt;

var
per_1,per_2:string;
lagi,lagi1,menu1:char;
n,i,angka:integer;

procedure garis;
begin
writeln(‘===============================================’);
end;

procedure data;
begin
clrscr;
writeln(‘PROGRAM DATA’);
garis;
write(‘masukan banyak data: ‘);readln(n);
i:=0;
for i:=1 to n do
write(‘data ke-‘,i,’ = ‘);readln(angka);
end;

procedure definisi;
begin
clrscr;
writeln(‘DEFINISI’);
garis;
writeln(‘Konjungsi adalah pernyataan majemuk dengan penghubung “dan”‘);
writeln(‘yang dilambangkan dengan “n”.’);
writeln(‘konjungsi “p dan q” dilambangkan dengan “p n q”‘);
garis;
end;

procedure tabel;
begin
clrscr;
writeln(‘TABEL KEBENARAN KONJUNGSI’);
garis;
writeln(‘——————————-‘);
writeln(‘P      Q                  P n Q’);
writeln(‘——————————-‘);
writeln(‘B      B                    B’);
writeln(‘B      S                    S’);
writeln(‘S      B                    S’);
writeln(‘S      S                    S’);
writeln(‘——————————-‘);
end;

procedure program_kon;
begin
repeat
clrscr;
writeln(‘PROGRAM KONJUNGSI’);
garis;
writeln(‘NOTE: tulis pernyataan dengan huruf besar (B/S)’);
garis;
write(‘pernyataan 1 (B/S): ‘);readln(per_1);
write(‘pernyataan 1 (B/S): ‘);readln(per_2);
writeln;
if (per_1=’B’) and (per_2=’B’) then
writeln(‘maka konjungsinya bernilai: BENAR’)
else
writeln(‘maka konjungsinya bernilai: SALAH’);
writeln;

writeln;
write(‘kembali?(y/t): ‘);readln(lagi1);
lagi1:=upcase(lagi1);
until lagi1=’T’;
end;

begin
lagi:=’y’;
while (lagi=’y’) or (lagi=’Y’) do
begin
clrscr;
writeln(‘nama           : novri irawan’);
writeln(‘nim            : 2225092262’);
writeln(‘smstr/kelas    : 3/D’);
writeln(‘materi         : logika matematika’);
garis;
writeln(‘KONJUNGSI’);
garis;
writeln(‘1 DEFINISI’);
writeln(‘2 TABEL KEBENARAN KONJUNGSI’);
writeln(‘3 PROGRAM KONJUNGSI’);
writeln(‘4 PROGRAM DATA’);
garis;
writeln;
write(‘pilih no: ‘);readln(menu1);
case menu1 of
‘1’:definisi;
‘2’:tabel;
‘3’:program_kon;
‘4’:data;
else
clrscr;
writeln(‘lihat pilihannya baik-baik’);
end;
writeln;
write(‘kembali ke menu?(y/t): ‘);readln(lagi);
end;
end.