ITT-Prokom04
Would you like to react to this message? Create an account in a few clicks or log in to continue.

KONVERSI BILANGAN BINER KE BILANGAN INTEGER??!!

2 posters

Go down

KONVERSI BILANGAN BINER KE BILANGAN INTEGER??!! Empty KONVERSI BILANGAN BINER KE BILANGAN INTEGER??!!

Post  113080211_danc Wed Dec 17, 2008 9:32 pm

Tolong saya memecahkan kasus ini:

Buatlah ALGORITMA(bukan pascal) untuk melakukan konversi pada pita karakter yg mengandung bilangan biner dan mengubahnya menjadi bilangan integer...

tolong..plis..plis...hehehe..thx before.. Laughing
113080211_danc
113080211_danc

Posts : 8
Join date : 2008-12-03
Age : 33
Location : Bandung

Back to top Go down

KONVERSI BILANGAN BINER KE BILANGAN INTEGER??!! Empty Re: KONVERSI BILANGAN BINER KE BILANGAN INTEGER??!!

Post  113071025_dblackfox Thu Dec 18, 2008 3:23 pm

113080211_danc wrote:Tolong saya memecahkan kasus ini:

Buatlah ALGORITMA(bukan pascal) untuk melakukan konversi pada pita karakter yg mengandung bilangan biner dan mengubahnya menjadi bilangan integer...

tolong..plis..plis...hehehe..thx before.. Laughing


Program ConvertToBiner;

Uses crt;

Var
w,x,y,z:integer;
sisa:integer;
xb,xc:string;

Procedure itungbasis (var x,y:integer);

begin
xb:=' ';
sisa:=0;

repeat
sisa:=x mod y;
x:=x div y;
xb:=char (sisa + $30) + xb;
until
(x=0);

writeln('X terhadap basis 1 adalah ',xb);

end;

Procedure itungbiner (var x:integer);

begin
xc:=' ';
sisa:=0;

repeat
sisa:=w mod 2;
w:=w div 2;
xc:=char (sisa + $30) + xc;
until
(w=0);

writeln('X terhadap basis 2 adalah ',xc);

end;



begin
clrscr;

write('Masukkan X= '); readln(x);
writeln;
write('Masukkan basis 1= '); readln(y);
write('Masukkan basis 2= '); readln(z);
writeln;
w:=x;
itungbasis(x,y);
itungbiner(x);

writeln;
readln;
end.



Bisa dicoba. Ini program dari pascal yg saya buat sendiri untuk tugas PTI. Harap maklum klo ada yg outputnya salah ntar.
113071025_dblackfox
113071025_dblackfox

Posts : 7
Join date : 2008-12-03
Age : 34
Location : Bangkok

http://lelekribo.wordpress.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum