Ari Usman Chaniago
Berbagi itu Indah
Program konversi_Biner_to_Dec;uses crt;var bilBiner : String; function pangkat(a, b : integer): integer;var i, hasil : integer;beginhasil := 1;for i:=1 to b dobeginhasil := hasil * a;end;pangkat := hasil;end; function bin2Dec(biner : string) : integer;var n, sum, i : integer;beginn := length(biner);sum := 0;for i := n-1 downto 0 dobeginif (biner [n-1] = ‘0’) then sum
DetailsProgram konversi_Desimal_to_Biner;uses crt;var bilangan:integer; function decToBin(desimal:integer):string;var hasilbagi, sisa:integer;bin:char;bilBiner:string;beginhasilBagi := desimal div 2;bilBiner := ”; while (hasilBagi >= 1) dobeginsisa := desimal mod 2;if (sisa = 0)then bin := ‘0’else if (sisa = 1) then bin := ‘1’; bilBiner:=bin + bilBiner; desimal := hasilBagi;hasilBagi := desimal div 2;end;decToBin:=’1′ + bilBiner;end; beginclrscr;writeln(‘KONVERSI BILANGAN DESIMAL KE BINER’);writeln;write(‘masukkan bilangan
Details