program matiks;
uses wincrt;
type
arin=array [1..100] of integer;
function rata(b:arin;m,n:integer):real;
var
i,j,domp:integer;
begin
domp:=0;
for i:=1 to m do
begin
for j:= 1 to n do
begin
domp:=domp+b[j];
end;
end;
rata:=domp/(m*n);
end;
var
a:arin;
i,j,m,n:integer;
domp:real;
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;
domp:=rata(a,m,n);
writeln('jadi rata-rata matriks adalah ',domp:0:2);
end.
uses wincrt;
type
arin=array [1..100] of integer;
function rata(b:arin;m,n:integer):real;
var
i,j,domp:integer;
begin
domp:=0;
for i:=1 to m do
begin
for j:= 1 to n do
begin
domp:=domp+b[j];
end;
end;
rata:=domp/(m*n);
end;
var
a:arin;
i,j,m,n:integer;
domp:real;
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;
domp:=rata(a,m,n);
writeln('jadi rata-rata matriks adalah ',domp:0:2);
end.
No comments:
Post a Comment