Selasa, September 13, 2016

Pascal Programming Convert Decimal To Others Base Number (Base 2 - Base 9) Version1

uses crt;
var
a,b,d,e,f,g:integer;
c:array[1..255] of integer;

begin
clrscr;
write('input a decimal number! ');
readln(a);
write('how base number will be change to? ');
readln(g);
write(g,' base number of decimal number (base 10) ',a,' is ');

if a<=g-1 then write(a) else

repeat
b:=b+1;
d:=trunc(a/g);
c[b]:=a mod g;
if d<=g-1 then
begin
b:=b+1;
c[b]:=d;
end;
a:=d;
until d<=g-1;

for e:=b downto 1 do
begin
write(c[e]);
end;

readln
end.

please check di http://www.convertworld.com/id/angka/Desimal.html

0 komentar: