program FF;
uses crt;
var
pr, nx : integer;
pilihan : integer;
choice1, choice2, j, k, r, s : string;
procedure JK ;
begin
clrscr;
writeln(' PROGRAM JK FLIP-FLOP ');
writeln;
write('masukkan nilai present : (1/0)');
readln(pr);
write('masukkan nilai next : (1/0)');
readln(nx);
if (pr = 0) and (nx = 0) then
begin
j := '0';
k := 'x';
writeln('nilai j = ', j);
writeln('nilai k = ', k);
end
else if (pr = 0) and (nx = 1) then
begin
j := '1';
k := 'x';
writeln('nilai j = ', j);
writeln('nilai k = ', k);
end
else if (pr = 1) and (nx = 0) then
begin
j := 'x';
k := '1';
writeln('nilai j = ', j);
writeln('nilai k = ', k);
end
else
begin
j := 'x';
k := '0';
writeln('nilai j = ', j);
writeln('nilai k = ', k);
end;
readln;
end.
procedure SR ;
begin
clrscr;
writeln(' PROGRAM SR FLIP-FLOP ');
writeln;
write('masukkan nilai present : (1/0)');
readln(pr);
write('masukkan nilai next : (1/0)');
readln(nx);
if (pr = 0) and (nx = 0) then
begin
j := '0';
k := 'x';
writeln('nilai s = ', s);
writeln('nilai r = ', r);
end
else if (pr = 0) and (nx = 1) then
begin
j := '1';
k := '0';
writeln('nilai s = ', s);
writeln('nilai r = ', r);
end
else if (pr = 1) and (nx = 0) then
begin
j := '0';
k := '1';
writeln('nilai s = ', s);
writeln('nilai r = ', r);
end
else
begin
j := 'x';
k := '0';
writeln('nilai s = ', s);
writeln('nilai r = ', r);
end;
readln;
end.
Tidak ada komentar:
Posting Komentar