Minggu, Agustus 28, 2016

Program Pascal Mengubah Bilangan Desimal ke Bilangan Basis Lain (Basis 2 - Basis 9) Versi 1

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

begin
clrscr;
write('masukkan sebuah bilangan desimal ');
readln(a);
write('akan diubah ke bilangan basis berapa? ');
readln(g);
write('bilangan basis ',g,' dari bilangan desimal (basis 10) ',a,' adalah ');

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.

silakan cek di http://www.convertworld.com/id/angka/Desimal.html

Kamis, Agustus 18, 2016

Pascal Programming Convert Decimal (Base 10) to Nonary (Base 9)

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

begin
clrscr;
write('input a decimal number! ');
readln(a);
write('nonary of decimal ',a,' is ');

if a<=8 then write(a) else

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

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

readln
end.

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

Program Pascal Mengubah Bilangan Desimal (Basis 10) ke Bilangan Nonari (Basis 9)

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

begin
clrscr;
write('masukkan sebuah bilangan desimal ');
readln(a);
write('bilangan nonari (basis 9) dari bilangan desimal (basis 10) ',a,' adalah ');

if a<=8 then write(a) else

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

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

readln
end.

silakan cek di http://www.convertworld.com/id/angka/Desimal.html

Pascal Programming Convert Decimal (Base 10) to Octal (Base 8)

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

begin
clrscr;
write('input a decimal number! ');
readln(a);
write('octal of decimal ',a,' is ');

if a<=7 then write(a) else

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

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

readln
end.

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

Program Pascal Mengubah Bilangan Desimal (Basis 10) ke Bilangan Oktal (Basis 8)

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

begin
clrscr;
write('masukkan sebuah bilangan desimal! ');
readln(a);
write('bilangan oktal (basis 8) dari bilangan desimal (basis 10) ',a,' adalah ');

if a<=7 then write(a) else

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

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

readln
end.

silakan cek di http://www.convertworld.com/id/angka/Desimal.html

Pascal Programming Convert Decimal (Base 10) to Septenary (Base 7)

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

begin
clrscr;
write('input a decimal number! ');
readln(a);
write('septenary of decimal ',a,' is ');

if a<=6 then write(a) else

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

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

readln
end.

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

Program Pascal Mengubah Bilangan Desimal (Basis 10) ke Bilangan Septenari (Basis 7)

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

begin
clrscr;
write('masukkan sebuah bilangan desimal! ');
readln(a);
write('bilangan septenari (basis 7) dari bilangan desimal (basis 10) ',a,' adalah ');

if a<=6 then write(a) else

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

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

readln
end.

silakan cek di http://www.convertworld.com/id/angka/Desimal.html