Minggu, 04 Maret 2012

Tugas 1 Struktur Data

  1. Program Untuk Perkalian Dua Matrik

  2. Program Perkalian_Matrix_Andre;

    uses
    wincrt;
    var
    a,b,c : array [1..10,1..10] of integer;
    i,j,k,x,y,z : integer;

    begin
    writeln('PROGRAM PERKALIAN MATRIX');
    writeln;
    writeln('ORDO MATRIX A');
    write('Jumlah Baris : '); readln(x);
    write('Jumlah Kolom : '); readln(y);
    writeln;
    writeln('ORDO MATRIX B');
    writeln('Jumlah Baris : ',y);
    write('Jumlah Kolom : '); readln(z);
    writeln;

    writeln ('MATRIX A');
    for i:=1 to x do
    for j:=1 to y do
    begin
    write('Nilai Matrix A Baris ',i,', Kolom ',j,' : ');readln(a[i,j]);
    end;

    writeln;
    writeln ('MATRIX B');
    for i:=1 to y do
    for j:=1 to z do
    begin
    write('Nilai Matrix B Baris ',i,', Kolom ',j,' : '); readln(b[i,j]);
    end;

    for i:=1 to x do
    for j:=1 to z do
    for k:=1 to y do
    c[i,j] := c[i,j] + a[i,k]*b[k,j];
    writeln;

    writeln('HASIL PERKALIAN MATRIX ADALAH : ');
    writeln;
    for i:=1 to x do
    begin
    for j:=1 to z do
    write(c[i,j]:3);
    writeln;
    writeln;
    end;
    end.

    Print Screen / Prt Scr :



  3. Program Menampilkan Matrik Identitas Terbalik

  4. Program Matrik_Identitas_Andre;
    uses
    wincrt;
    var
    a,b,c:array[1..5,1..5] of integer;
    x,y: integer;

    begin
    for x:= 1 to 5 do
    begin
    for y:= 1 to 5 do
    begin
    a[x,y]:=0;
    if x+y=6 then c[x,y]:=1;
    write (c[x,y]:4);
    end;
    writeln;
    end;
    end.

    Print Screen / Prt Scr :

Tidak ada komentar:

Posting Komentar