program konversi_biner;
uses wincrt;
var desimal,d,sisa,biner:integer;
begin
write('angka desimal='); readln(desimal);
d:=0;
repeat
sisa:=desimal mod 2;
desimal:=desimal div 2;
if (d=0) then d:=1
else
d:=d*10;
biner:=biner+sisa*d;
until desimal=0; write('biner=',biner);
end.
seperti pada gambar:
uses wincrt;
var desimal,d,sisa,biner:integer;
begin
write('angka desimal='); readln(desimal);
d:=0;
repeat
sisa:=desimal mod 2;
desimal:=desimal div 2;
if (d=0) then d:=1
else
d:=d*10;
biner:=biner+sisa*d;
until desimal=0; write('biner=',biner);
end.
seperti pada gambar:
Posting Komentar