SOURCE CODE:
program flip_flop;
uses crt;
var
pr, nx : integer;
choice1, choice2, j, k: string;
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.
Tidak ada komentar:
Posting Komentar