Rabu, 31 Desember 2008

algoritma 3 karakter ver 1

program karakter3
kamus
cptitu:integer
c1,c2 : character
procedure adv-couple
procedure start-couple
algoritma
start couple
cptitu<=0
while cc <>'.' do
if c1='i' and c2='t' then adv couple
if c1='t' and c2='u' then cptitu<=cptitu+1
adv couple
output(cptitu)

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.

Kamis, 04 Desember 2008

algoritma 4karakter

program karakter4
kamus
cptMATA : integer
pres_is_MA: boolean
pres_is_TA: boolean
algoritma
cptMATA<-0
START COUPLE
while CC<> '.' do
pres_is_MA <- false
pres_is_TA <- C1='M' and C2='A'
ADV COUPLE
pres_is_TA <- false
pres_is_TA <- C1='T' and C2='A'
if pres_is_MA and pres_is_TA then
cptMATA<-cptMATA+1
ADV COUPLE

Popular Posts

Pages

Followers

Featured Posts