Assalamu'alikum wr.wb.
Pada kesempatan kali ini saya akan membagikan tentang program menghitung matrik pada pascal menggunkan array.
Baris Program:
uses wincrt;
var
i,j,r:Array[1..10,1..10] of integer;
m,n,p:array[1..10,1..10]of integer;
a,b,hasil: array[1..20,1..20]of integer;
baris,kolom,baris2,kolom2:integer;
begin
writeln(‘—– Masukkan Matrix R —–’);
write(‘jumlah baris : ‘);readln(baris);
write(‘jumlah kolom : ‘);readln(kolom);
for baris:=1 to baris do
for kolom:=1 to kolom do
begin
write(‘[',baris,',',kolom,'] = ‘);readln(R[baris,kolom]);
end;
writeln(‘—– Masukkan Matrix P —–’);
write(‘jumlah baris : ‘);readln(baris);
write(‘jumlah kolom : ‘);readln(kolom);
for baris:=1 to baris do
for kolom:=1 to kolom do
begin
write(‘[',baris,',',kolom,'] = ‘);readln(P[baris,kolom]);
end;
writeln;
{————————- TAMPILKAN ————————}
{————————————————————}
for baris:=1 to baris do
begin
for kolom:=1 to kolom do
begin
write(R[baris,kolom]);
write(‘ ‘);
end;
writeln;
end;
writeln(‘ditambah dengan : ‘);
for baris:=1 to baris do
begin
for kolom:=1 to kolom do
begin
write(P[baris,kolom]);
write(‘ ‘);
end;
writeln;
end;
writeln(‘menjadi : ‘);
for kolom:=1 to kolom do
begin
for baris:=1 to baris do
begin
hasil[baris,kolom]:=R[baris,kolom] + P[baris,kolom];
end;
end;
for baris:=1 to baris do
begin
for kolom:=1 to kolom do
begin
write(hasil[baris,kolom]);
write(‘ ‘);
end;
writeln;
end;
writeln(‘created by retnodn’);
end.
Scrnshoot:
Pada kesempatan kali ini saya akan membagikan tentang program menghitung matrik pada pascal menggunkan array.
Baris Program:
uses wincrt;
var
i,j,r:Array[1..10,1..10] of integer;
m,n,p:array[1..10,1..10]of integer;
a,b,hasil: array[1..20,1..20]of integer;
baris,kolom,baris2,kolom2:integer;
begin
writeln(‘—– Masukkan Matrix R —–’);
write(‘jumlah baris : ‘);readln(baris);
write(‘jumlah kolom : ‘);readln(kolom);
for baris:=1 to baris do
for kolom:=1 to kolom do
begin
write(‘[',baris,',',kolom,'] = ‘);readln(R[baris,kolom]);
end;
writeln(‘—– Masukkan Matrix P —–’);
write(‘jumlah baris : ‘);readln(baris);
write(‘jumlah kolom : ‘);readln(kolom);
for baris:=1 to baris do
for kolom:=1 to kolom do
begin
write(‘[',baris,',',kolom,'] = ‘);readln(P[baris,kolom]);
end;
writeln;
{————————- TAMPILKAN ————————}
{————————————————————}
for baris:=1 to baris do
begin
for kolom:=1 to kolom do
begin
write(R[baris,kolom]);
write(‘ ‘);
end;
writeln;
end;
writeln(‘ditambah dengan : ‘);
for baris:=1 to baris do
begin
for kolom:=1 to kolom do
begin
write(P[baris,kolom]);
write(‘ ‘);
end;
writeln;
end;
writeln(‘menjadi : ‘);
for kolom:=1 to kolom do
begin
for baris:=1 to baris do
begin
hasil[baris,kolom]:=R[baris,kolom] + P[baris,kolom];
end;
end;
for baris:=1 to baris do
begin
for kolom:=1 to kolom do
begin
write(hasil[baris,kolom]);
write(‘ ‘);
end;
writeln;
end;
writeln(‘created by retnodn’);
end.
Scrnshoot:
Demikian yang dapat saya sampaikan tentang perulangan array program penjumlahan matrik pada pascal, semoga bermanfaat. Wassalamu'alikum wr.wb.
0 comments:
Post a Comment