Berikut adalah Source Code Program Penghitung Perkalian Matrik Paling Lengkap dalam Bahasa Pascal.

Data arsip dari Die Coding, silakan digunakan dan diubah sesuka hati, semoga bermanfaat.

program aplikasi1;
uses crt;

// dimensi matrik (baris, kolom)
type ordo = array[1..100, 1..100] of real;

// deklarasi variabel
var matrik1, matrik2, hasil         : ordo;
    skalar                          : real;
    bar1, col1, bar2, col2, i, j, z : byte;
    pil                             : string[1];

// function hasil skalar
function hasilSkalar(): ordo;
begin
    clrscr;
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |'); 
    writeln(' |             HASIL PERKALIAN MATRIK              |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');

    // proses mengitung
    for i := 1 to bar2 do
        for j := 1 to col2 do
            hasil[i, j] := skalar * matrik2[i, j];

    // tampilkan hasil perhitungan
    for i := 1 to bar2 do
        for j := 1 to col2 do begin
            gotoxy((j-1)*12 + 2, i*2 + 5);
            write(hasil[i, j]:0:2);
        end;
end;

// funcion hasil matrik
function hasilMatrik(): ordo;
begin
    clrscr;
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |'); 
    writeln(' |             HASIL PERKALIAN MATRIK              |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');

    // proses menghitung
    for i := 1 to bar1 do
        for j := 1 to col2 do begin
            hasil[i, j] := 0;
            for z := 1 to bar2 do
                hasil[i, j] := hasil[i, j] + matrik1[i, z] * matrik2[z, j];
        end;

    // tampilkan hasil perhitungan
    for i := 1 to bar1 do
        for j := 1 to col2 do begin
            gotoxy((j-1)*12 + 2, i*2 + 5);
            write(hasil[i, j]:0:2);
        end;
end;

// procedure identitas
procedure identitas;
begin
    clrscr;
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |');    
    writeln(' |                   APLIKASI 1                    |');
    writeln(' |       PROGRAM PENGHITUNG PERKALIAN MATRIK       |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |');    
    writeln(' |              source: diecoding.com              |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');
    writeln;
    writeln;
    writeln;
end;

procedure error;
begin
    writeln;
    writeln;
    writeln;
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |'); 
    writeln(' | !!! SYARAT PERKALIAN MATRIK TIDAK TERPENUHI !!! |'); 
    writeln(' |    JUMLAH KOLOM MATRIK I =/= BARIS MATRIK II    |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');
end;

// procedure inputMatrik
procedure inputMatrik;
begin
    clrscr;
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |');
    writeln(' |                    MATRIK I                     |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');
    writeln;
    writeln;
    write(' Masukan banyak baris : '); readln(bar1);
    while (bar1 < 1) or (bar1 > 100) do begin
        writeln;
        writeln('  ------------------------------------------------- ');
        writeln(' |                                                 |');    
        writeln(' |    !!! JUMLAH BARIS TIDAK DIPERBOLEHKAN !!!     |');
        writeln(' |    BANYAK BARIS YANG DIPERBOLEHKAN 1 - 100      |');
        writeln(' |                                                 |');
        writeln('  ------------------------------------------------- ');
        writeln;
        write(' Masukan banyak baris : '); readln(bar1);
    end;
            
    write(' Masukan banyak kolom : '); readln(col1);
    while (col1 < 1) or (col1 > 100) do begin
        writeln;
        writeln('  ------------------------------------------------- ');
        writeln(' |                                                 |');    
        writeln(' |    !!! JUMLAH KOLOM TIDAK DIPERBOLEHKAN !!!     |');
        writeln(' |    BANYAK KOLOM YANG DIPERBOLEHKAN 1 - 100      |');
        writeln(' |                                                 |');
        writeln('  ------------------------------------------------- ');
        writeln;
        write(' Masukan banyak kolom : '); readln(col1);
    end;
            
    writeln;
    writeln;
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |'); 
    writeln(' |                    MATRIK II                    |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');
    writeln;
    writeln;
    write(' Masukan banyak baris : '); readln(bar2);
    while (bar2 < 1) or (bar2 > 100) do begin
        writeln;
        writeln('  ------------------------------------------------- ');
        writeln(' |                                                 |');    
        writeln(' |    !!! JUMLAH BARIS TIDAK DIPERBOLEHKAN !!!     |');
        writeln(' |    BANYAK BARIS YANG DIPERBOLEHKAN 1 - 100      |');
        writeln(' |                                                 |');
        writeln('  ------------------------------------------------- ');
        writeln;
        write(' Masukan banyak baris : '); readln(bar2);
    end;
            
    write(' Masukan banyak kolom : '); readln(col2);
    while (col2 < 1) or (col2 > 100) do begin
        writeln;
        writeln('  ------------------------------------------------- ');
        writeln(' |                                                 |');    
        writeln(' |    !!! JUMLAH KOLOM TIDAK DIPERBOLEHKAN !!!     |');
        writeln(' |    BANYAK KOLOM YANG DIPERBOLEHKAN 1 - 100      |');
        writeln(' |                                                 |');
        writeln('  ------------------------------------------------- ');
        writeln;
        write(' Masukan banyak kolom : '); readln(col2);
    end;
end;

// procedure matrik skalar
procedure matrikSkalar;
begin
    clrscr;
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |'); 
    writeln(' |                MATRIK I (SKALAR)                |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');

    gotoxy(3, 8);
    readln(skalar);
    
    clrscr;
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |'); 
    writeln(' |                    MATRIK II                    |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');

    for i := 1 to bar2 do
        for j := 1 to col2 do begin
            gotoxy((j-1)*12 + 2, i*2 + 5);
            readln(matrik2[i, j]);
        end;

    hasilSkalar();
end;

// procedure matrik asli
procedure matrikAsli;
begin
    clrscr;
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |'); 
    writeln(' |                    MATRIK I                     |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');

    // input matrik i
    for i := 1 to bar1 do
        for j := 1 to col1 do begin
            gotoxy((j-1)*12 + 2, i*2 + 5);
            readln(matrik1[i, j]);
        end;
    
    clrscr;
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |'); 
    writeln(' |                    MATRIK II                    |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');

    // input matrik ii
    for i := 1 to bar2 do
        for j := 1 to col2 do begin
            gotoxy((j-1)*12 + 2, i*2 + 5);
            readln(matrik2[i, j]);
        end;

    hasilMatrik();
end;

// procedure panduan
procedure panduan;
begin
    clrscr;
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |');    
    writeln(' |               PANDUAN PENGGUNAAN                |');
    writeln(' |       PROGRAM PENGHITUNG PERKALIAN MATRIK       |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |');
    writeln(' | 1. PROGRAM INI HANYA UNTUK MENGHITUNG PERKALIAN |');
    writeln(' |    MATRIK.                                      |');
    writeln(' | 2. PERHITUNGAN HANYA DAPAT DILAKUKAN UNTUK 2    |');
    writeln(' |    MATRIK.                                      |');
    writeln(' | 3. ORDO DARI MASING-MASING MATRIK MINIMAL 1 x 1 |');
    writeln(' |    DAN MAKSIMAL 100 x 100.                      |');
    writeln(' | 4. UNTUK PENGHITUNGAN SKALAR DENGAN MATRIK,     |');
    writeln(' |    GUNAKAN MATRIK I DENGAN ORDO 1 x 1 SEBAGAI   |');
    writeln(' |    BILANGAN SKALAR.                             |');
    writeln(' | 5. UNTUK BILANGAN DESIMAL GUNAKAN TANDA TITIK   |');
    writeln(' |    (.) SEBAGAI PEMISAH.                         |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');
    writeln;
end;

procedure penutup;
begin
    clrscr;
    writeln('  ------------------------------------------------- ');
    writeln(' |                                                 |');    
    writeln(' |         TERIMA KASIH TELAH MENGGUNAKAN          |');
    writeln(' |    PROGRAM PENGHITUNG PERKALIAN MATRIK KAMI     |');
    writeln(' |                                                 |');
    writeln('  ------------------------------------------------- ');
    write(' '); readkey;
end;


// program utama
begin
    identitas;
    write(' Baca panduan penggunaan? y|n : '); readln(pil);
    while (lowercase(pil) <> 'n') and (lowercase(pil) <> 'y') do begin
        write(' Baca panduan penggunaan? y|n : '); readln(pil);
    end;
    if lowercase(pil) = 'y' then begin
        panduan;
        writeln(' Tekan [ ENTER ] untuk melanjutkan atau   --------- ');
        writeln(' [ Q kemudian ENTER ] untuk keluar       |         |');
        writeln(' program !                                --------- ');
        gotoxy(47, 24);
        readln(pil);
        if (lowercase(pil) = 'q') then
            penutup;
    end;
    
    repeat
        inputMatrik;
        if (bar1 = 1) and (col1 = 1) then
            matrikSkalar
        else if (col1 = bar2) then
            matrikAsli
        else
            error;

        // konfirmasi pengulangan program
        writeln;
        writeln;
        writeln;
        write(' Ingin mencoba lagi? y|n : ');  readln(pil);
        while (lowercase(pil) <> 'n') and (lowercase(pil) <> 'y') do begin
            write(' Ingin mencoba lagi? y|n : '); readln(pil);
        end;
    until lowercase(pil) = 'n';
    penutup;
end.