program matrik;
var
k,x:integer;
A:array[1..10] of integer;
Begin
for k:=1 to 5 do
x:=x+A[k];
writeln('hasil= ',x);
end.
program matrik;
var
x,y: integer;
p: array [1..3, 1..3] of integer;
q: array [1..3, 1..3] of integer;
begin
writeln ('program menhitung matrik');
writeln ('========================');
for x:= 1 to 3 do
for y:= 1 to 3 do
begin
write ('masukkan nilai matrik p [',x,',',y,']= ');
readln (p[x,y]);
end;
for x:= 1 to 3 do
begin
write ('|');
for y:= 1 to 3 do
write (p[x,y]:8);
write ('|');
writeln;
end;
for y:= 1 to 3 do
for x:= 1 to 3 do
begin
write ('masukkan nilai matrik q [',y,',',x,']= ');
readln (q[y,x]);
end;
for y:= 1 to 3 do
begin
write ('|');
for x:= 1 to 3 do
write (q[y,x]:8);
write ('|');
writeln;
end;
writeln ('maka hasil matrik= ');
write ('|');
write ((p[1,1]+p[2,2]+p[3,3])+(q[2,1]+q[2,2]+q[2,3])+((q[3,1]+q[3,2]+q[3,3])+(q[3,1]+q[2,2]+q[1,3])+(q[1,3]+q[2,3]+q[3,3])));
writeln;
end.
var
k,x:integer;
A:array[1..10] of integer;
Begin
for k:=1 to 5 do
x:=x+A[k];
writeln('hasil= ',x);
end.
program matrik;
var
x,y: integer;
p: array [1..3, 1..3] of integer;
q: array [1..3, 1..3] of integer;
begin
writeln ('program menhitung matrik');
writeln ('========================');
for x:= 1 to 3 do
for y:= 1 to 3 do
begin
write ('masukkan nilai matrik p [',x,',',y,']= ');
readln (p[x,y]);
end;
for x:= 1 to 3 do
begin
write ('|');
for y:= 1 to 3 do
write (p[x,y]:8);
write ('|');
writeln;
end;
for y:= 1 to 3 do
for x:= 1 to 3 do
begin
write ('masukkan nilai matrik q [',y,',',x,']= ');
readln (q[y,x]);
end;
for y:= 1 to 3 do
begin
write ('|');
for x:= 1 to 3 do
write (q[y,x]:8);
write ('|');
writeln;
end;
writeln ('maka hasil matrik= ');
write ('|');
write ((p[1,1]+p[2,2]+p[3,3])+(q[2,1]+q[2,2]+q[2,3])+((q[3,1]+q[3,2]+q[3,3])+(q[3,1]+q[2,2]+q[1,3])+(q[1,3]+q[2,3]+q[3,3])));
writeln;
end.
0 comments:
Posting Komentar