This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Tampilkan postingan dengan label PASCAL. Tampilkan semua postingan
Tampilkan postingan dengan label PASCAL. Tampilkan semua postingan

Selasa, 17 April 2012

PROGRAM PENGURUTAN DATA

program pengurutan data;
uses wincrt;
const NilaiMaksimum = 1000;
type Larik = array[1..NilaiMaksimum] of integer;
var
L : Larik;
batas : integer;
           procedure masukan (var L : Larik; n : integer);
           var
                 a : integer;
           begin
             for a := 1 to n do
                 begin
                    write('Masukkan Nilai Ke-' ,a,' : '); readln(L[a]);
                    end;
                 end;
           procedure pengurutan (var L : Larik; n : integer);
           var
                 i : integer;
                 k : integer;
                 temp : integer;
           begin
             for i := 1 to (n-1) do
               for k := n downto i+1 do
                 if L[k] < L[k-1] then
                 begin
                 temp := L[k];
                 L[k] := L[k-1];
                 L[k-1] := temp;
               end;
             end;
           procedure keluaran(var L : Larik; n : integer);
           var
                i : integer;
           begin
             for i := 1 to n do
                    write(L[i]:5);
             end;
begin
  writeln ('*******************************************') ;
  write('Masukkan Jumlah Elemen yang diinginkan : '); readln(batas);
  writeln ('*******************************************') ;
  writeln;
  masukan(L,batas) ; writeln;
  pengurutan (L,batas); writeln;
  writeln ('************************') ;
  writeln('Hasil Pengurutan Larik :  ');
  writeln ('************************') ;
  keluaran(L,batas);
end.

MENCARI NILAI RATA-RATA MAHASISWA

uses wincrt;
var
nama,nim:string;
nt,nmt,na:integer;
nr :real;

begin
writeln ('        DAFTAR NILAI MAHASISWA');
write ('Nama  : ');
readln (nama);
write ('NIM   : ');
readln (nim);
write ('Nilai Tugas      : ');
readln (nt);
write ('Nilai Mid Test   : ');
readln (nmt);
write ('Nilai Akhir      : ');
readln (na);

nr:=(0.5*nt)+(0.25*nmt)+(0.25*na);

writeln ('Rata-rata      : ',nr:0:2);
end.

Sabtu, 19 November 2011

Soal Tabel Kebenaran

Diketahui suatu ekspresi logika sebagai berikut:
NOT (A AND B) OR (C XOR NOT D) = NOT (A OR NOT B) AND (C OR D)
Apa hasil dari ekspresi logika tsb.
Jawab:
Konversikan terlebih dahulu :
*Sebelah kiri
-A "AND" B
-"NOT" B
-C "XOR" (NOT B)
-"NOT" (A AND B)
-NOT ( A AND B ) "OR" C XOR NOT B
*Sebelah Kanan
-"NOT" B
-A "OR" (NOT B)

-"NOT" (A OR NOT B)
-C "OR" D
-NOT (A OR NOT B) "AND" (C OR D)
*Bandingkan hasil sebelah kanan dengan hasil sebelah kiri..jika hasilnya sama berarti hasilnya TRUE
*Jika hasilnya lain berarti hasilnya FALSE

Menggunakan Tabel Kebenaran


Jadi :
NOT (A AND B) OR (C XOR NOT D) = NOT (A OR NOT B) AND (C OR D) = FALSE
Mari kita buktikan dengan menggunakan PASCAL