program aku;
uses Crt;
var
I,J : integer;
a,b,c : array [1..3, 1..2] of integer;
ch : char;
begin
clrscr;
writeln ('program menghitung pertambahan matrix 3x2');
writeln ('==================================');
for J := 1 to 2 do
begin
write ('masukkan nilai matrik a[',I,',',J,']=');
readln (a[I,J]);
write ('masukkan nilai matrik b[',I,',',J,']=');
readln (b[I,J]);
end;
writeln;
writeln('maka hasil dari matrik a+b =');
for I:= 1 to 3 do
begin
write ('|');
for J : 1 to 2 do
write (a[I,J] + b[I,J]:8;
write ('|');
writeln;
end;
write (.press any key to continue..');
end.
program informatika;
var
a,b,c : array [1..100, 1..100] of integer;
n,m,k,l,i,j: integer;
begin
write ('m= '); readln (m);
write ('n= '); readln (n);
for i:= 1 to m do
for j:= 1 to n do
begin
write ('a[',i,',',j,']='); readln (a[i,j]);
end;
write ('k= '); readln (k);
write ('l= '); readln (l);
for i:=1 to k do
for j:=1 to l do
begin
write ('b[',i,',',j,']=');readln (b[i,j]);
end;
writeln ('maka hasil dari pertambahan matrik a+b adalah');
if (m=k)and(n=l) then
for i:= 1 to m do
for j:= 1 to n do
begin
c[i,j]:= a[i,j] + b[i,j];
writeln ('c[',i,',',j,']=' , c[i,j]);
end
else
writeln ('tidak bisa');
end.
uses Crt;
var
I,J : integer;
a,b,c : array [1..3, 1..2] of integer;
ch : char;
begin
clrscr;
writeln ('program menghitung pertambahan matrix 3x2');
writeln ('==================================');
for J := 1 to 2 do
begin
write ('masukkan nilai matrik a[',I,',',J,']=');
readln (a[I,J]);
write ('masukkan nilai matrik b[',I,',',J,']=');
readln (b[I,J]);
end;
writeln;
writeln('maka hasil dari matrik a+b =');
for I:= 1 to 3 do
begin
write ('|');
for J : 1 to 2 do
write (a[I,J] + b[I,J]:8;
write ('|');
writeln;
end;
write (.press any key to continue..');
end.
program informatika;
var
a,b,c : array [1..100, 1..100] of integer;
n,m,k,l,i,j: integer;
begin
write ('m= '); readln (m);
write ('n= '); readln (n);
for i:= 1 to m do
for j:= 1 to n do
begin
write ('a[',i,',',j,']='); readln (a[i,j]);
end;
write ('k= '); readln (k);
write ('l= '); readln (l);
for i:=1 to k do
for j:=1 to l do
begin
write ('b[',i,',',j,']=');readln (b[i,j]);
end;
writeln ('maka hasil dari pertambahan matrik a+b adalah');
if (m=k)and(n=l) then
for i:= 1 to m do
for j:= 1 to n do
begin
c[i,j]:= a[i,j] + b[i,j];
writeln ('c[',i,',',j,']=' , c[i,j]);
end
else
writeln ('tidak bisa');
end.
0 comments:
Posting Komentar