Senin, 21 November 2011

program matrik dalam pascal


program matiks;

uses wincrt;

type
arin=array [1..100] of integer;

function cari(b:arin;m,n,x:integer):integer;
var
i,j,domp:integer;
begin
domp:=0;
for i:=1 to m do
begin
for j:= 1 to n do
begin
if b[j]=x then
domp:=domp+1;
end;
end;
cari:=domp;
end;


var
a:arin;
i,j,m,n,x,domp:integer;

begin
write('masukan jumlah baris : ');readln(n);
write('masukan jumlah kolom : ');readln(m);
for i:=1 to m do
begin
for j:= 1 to n do
begin
write('a[',i,',',j,'] : ');readln(a[j]);
end;
end;
write('masukan bilangan yang dicari : ');readln(x);
domp:=cari(a,m,n,x);
writeln('jadi bilangan yang dicari ada ',domp);
end.

0 komentar:

Poskan Komentar

Related Posts Plugin for WordPress, Blogger...