Pages

Monday, January 7, 2019

ASD 10

ASD 10a
program komar10a;
var
   i:byte;
   y:array[1..4] of integer;
begin
     y[1]:=10;
     y[2]:=9;
     y[3]:=11;
     y[5]:=8;

     for i:=1 to 4 do
     begin
     y[i]:=y[i]-i;
     writeln(y[i]);
readln;
end;

end.

====
ASD 10b
program komar10b;
type
    z=array[1..4] of string[10];
const
     bahasa:z=('Pascal','Java','Basic','PHP');
var
   a:word;
begin
     for a:=1 to 4 do
     writeln('Bahasa pemrograman ',a,' = ',bahasa[a]);
readln;

end.

===
ASD 10
program komar10c;
var
   kata: array[10..15] of string[10];
begin
     kata[11]:= 'Sedang ';
     kata[12]:= 'belajar ';
     kata[13]:= 'Logika ';
     kata[14]:= 'Algoritma';

     write(kata[11]);
     write(kata[12]);
     write(kata[13]);
     write(kata[14]);
readln;

end.

===
ASD 10d
program arrayCari;
const
  min = 1;
  max = 100;
type
  arrint = array [min..max] of integer;
var
  x      : integer;
  tabint : arrint;
  n,i    : integer;
  indeks : integer;
  function seqsearch1(xx : integer): integer;
  var i : integer;
  begin
    i := 1;
    while ((i<n) and (tabint[i] <> xx)) do
      i:=i+1;
      if tabint[i] = xx then
        seqsearch1:=i
        else
        seqsearch1:=0;
  end;

begin
  write('input nilai n = '); readln(n);
  for i:=1 to n do
    begin
      write('Tabint[',i,'] = '); readln(tabint[i]);
    end;
  write('Nilai yang dicari = '); readln(x);
  indeks:=seqsearch1(x);
  if indeks <> 0 then
    write(x,' ditemukan pada indeks ke ',indeks)
    else
    write(x,' tidak ditemukan');
  writeln;
writeln;
readln;
end.
Bitcoin Offers:
Free Bitcoin, Double Bitcoin, Bitcoin Investment, Bitcoin Trading



"Bitcoin and Forex are high risk business. We must join them smartly."

No comments:

Post a Comment