RSS Feed

Konversi bilangan Desimal Ke Biner

Posted by Rizki Labels:

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.

0 comments:

Post a Comment

WELCOME