Browsing All Posts filed under »Pascal Code«

Operasi matriks menggunakan fungsi

July 15, 2011

0

program operasi_matrix; const max = 50; type Mat = array [1..max, 1..max] of real; var u1, u2, u3, u4 : byte; i, j, pilih    : byte; m1, m2, m3     : Mat; procedure tampilMatrix(a: Mat; m, n : byte); var i, j : byte; begin for i:=1 to m do begin for j:=1 […]

Sorting with Merge Sort

August 5, 2010

0

Ilustration : step-1 numbers in array unsort step-2 split array step-3 split again… step-4 split again… step-5 split again…, and start to merging step-6 get the small value and save it into array step-7 first left side has finish The above ilustration has not yet fisnish, you can get the complete ilustration in here, and […]

Permutasi

July 1, 2010

0

program permutasi(input,output); uses crt; var    n,r:byte; function faktorial(c:byte):integer; begin    if c<=1 then       faktorial:=1    else       faktorial:=c*faktorial(c-1); end; function permutasi(a,b:byte):real; begin    permutasi:=faktorial(a)/faktorial(a-b); end; begin    clrscr;    writeln('Program mencari nilai permutasi');    write('Masukkan nilai n : '); readln(n);    write('Masukkan nilai r : '); readln(r);    writeln('Hasil Perhitungan : ', permutasi(n,r):0:2);    readln; end.

Find Modus

June 22, 2010

0

program find_modus(Output); uses crt; type    jns_nilai = (banyak_duplikasi, mungkin_modus);    cacahan_modus = array[1..1000, jns_nilai] of integer;    int_array = array[1..1000] of integer; var    x : int_array;    modus : cacahan_modus;    i, j, n, tmp, k : integer;    min, max : integer;    count, tmpmodus : integer; begin    clrscr;    write(‘banyak data : ‘); readln(n);    randomize; { .:: Input data ::. […]

MID and UAS value

June 21, 2010

0

program beri_nilai(Output); uses crt; type    jenis_ujian=(mid,uas); // nilai ordinalnya : 0,1    nilai= array[1..10,jenis_ujian] of byte; var    _n : nilai;    i,j : byte; begin    clrscr;    randomize;    for i:=1 to 10 do begin       for j:=ord(mid) to ord(uas) do begin          if (j=ord(mid)) then begin             _n[i,mid]:=random(100);             write(‘Nilai Mid siswa-‘,i,’ : ‘,_n[i,mid]);             write(‘ ‘:4);          end          else begin             _n[i,uas]:=random(100);             write(‘Nilai UAS […]

Repeat Input Until Not Duplicate

June 21, 2010

0

program repeat_while_input_duplicate(Output); uses crt; var    x : array[1..1000] of integer;    i, n, tmp, j, cacah : integer; begin    clrscr;    write(‘banyak data : ‘); readln(n); { .:: Input data ::. }    for i:=1 to n do begin       cacah:=0;       repeat          tmp:=random(100)+1;          if cacah0 then cacah:=0;          for j:=1 to i-1 do begin             if x[j]=tmp then cacah:=cacah+1;          end;       until […]

Find Mean and Median

June 21, 2010

0

program find_mean_median(Output); uses crt; var    x : array[1..1000] of integer;    i, j, n, tmp, k : integer;    mean, median : real;    min, max : integer; begin    clrscr;    write(‘banyak data : ‘); readln(n);    randomize; { .:: Input data ::. }    mean:=0;    for i:=1 to n do begin       x[i]:=random(100)+1;       write(x[i]:4,’ ‘);       if (i mod 15=0) then writeln; […]