Rabu, 31 Desember 2008

algoritma matrik

program matrik
kamus
i,j:integer
b:array[1..3,1..3] of integer
c:array[1..3,1..3] of integer
d:array[1..3,1..3] of integer
n:string
procedure kali
procedure jumlah
procedure kurang
begin
output('matrik 1')
i traversal [1..3]
j traversal [1..3]
input(b[i,j])
output('matrik 2')
i traversal [1..3]
j traversal [1..3]
input(c[i,j])
output('masukkan operasi matrik')
input(n)
depend on (n)
'tambah':jumlah
'kurang':kurang
'kali':kali
end.

procedure jumlah
begin
i traversal[1..3]
j traversal[1..3]
d[i,j]<=(b[i,j]+c[i,j])
output(d[i,j]
end

procedure kurang
begin
i traversal[1..3]
j traversal[1..3]
d[i,j]<=(b[i,j]-c[i,j])
output(d[i,j]
end

procedure kali
begin
i traversal[1..3]
j traversal[1..3]
d[i,j]<=(b[i,j]*c[j,i])
output(d[i,j])
end.

Tidak ada komentar:

Popular Posts

Pages

Followers

Featured Posts