Ni source codenya langsung copy aja ke pascal ok bos :
Uses wincrt;
Var
des , desi : integer;
jawaban : char;
procedure biner(des, desi : integer);
var bin : string;
begin
bin:='';
repeat
if(des mod 2 = 0) then bin:='0'+bin
else bin:='1' + bin;
des:=des div 2;
until des=0;
writeln;
writeln('(',desi,') desimal = ',bin,' (Biner)');
end;
procedure heksa(des, desi : integer);
var heks : string;
h : integer;
begin
Heks:='';
repeat
h:=des mod 16;
case h of
0: heks:= '0' + Heks;
1: heks:= '1' + Heks;
2: heks:= '2' + Heks;
3: heks:= '3' + Heks;
4: heks:= '4' + Heks;
5: heks:= '5' + Heks;
6: heks:= '6' + Heks;
7: heks:= '7' + Heks;
8: heks:= '8' + Heks;
9: heks:= '9' + Heks;
10: heks:= 'A' + Heks;
11: heks:= 'B' + Heks;
12: heks:= 'C' + Heks;
13: heks:= 'D' + Heks;
14: heks:= 'E' + Heks;
15: heks:= 'F' + Heks;
end;
des:=des div 16;
until des=0;
writeln('(',desi,') desimal = ',Heks,' (Heksadesimal)');
end;
procedure oktal(des, desi : integer);
var oktal : string;
o : integer;
begin
oktal:='';
repeat
o:=des mod 8;
case o of
0:oktal:='0'+oktal;
1:oktal:='1'+oktal;
2:oktal:='2'+oktal;
3:oktal:='3'+oktal;
4:oktal:='4'+oktal;
5:oktal:='5'+oktal;
6:oktal:='6'+oktal;
7:oktal:='7'+oktal;
end;
des:= des div 8;
until des=0;
writeln('(',desi,') desimal = ',oktal,' (Oktal)');
end;
begin
repeat
clrscr;
writeln('************************************************************** ');
writeln('* Program Konversi Desimal ke Heksadesimal, Biner dan Oktal * ');
writeln('* oleh: Habibie Ed Dien, Shohib, Nanda E.p. & Ahmad Rizal * ');
writeln('************************************************************** ');
writeln;
Write('Masukkan Suatu Bilangan Desimal : ');Readln(des);
desi:=des;
biner(des,desi);
heksa(des,desi);
oktal(des,desi);
writeln;writeln;
write('Mau coba lagi [Y/T]? : ');readln(jawaban);
until upcase(jawaban)<>'Y';
end.
running programnya seperti ini :
kalau masih bingunk comment ya????