USES CRT;
VAR Des:integer;
Bin:string;
begin
clrscr;
writeln('PROGRAM KONVERSI MENGUBAH BILANGAN DECIMAL KE BINER');
write('Masukkan bilangan Decimal=');
readln(Des);
Bin:=’’;
repeat
begin
{menghitung biner dari hasil bagi}
If Des mod 2=0 then Bin:='0'+Bin
else Bin:='1'+Bin;
{membagi bulat bilangan desimal}
Des:= Des div 2;
end;
Until Des=0;
Writeln('Bilangan Biner =',Bin);
readln;
end.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment