Program Penjumlahan Matrik di Pascal , semoga bisa membantu bagi anda semua dan untuk saya juga :)
uses wincrt;
var
matA,matB,matC:array[1..10,1..10] of integer;
kolom,baris:integer;
begin
writeln('==============');
writeln('|| MATRIK A ||');
writeln('==============');
write('Masukan Baris = ');readln(baris);
write('Masukan Kolom = ');readln(kolom);
writeln('=================');
for baris:=1 to baris do
for kolom:=1 to kolom do
begin
write('Masukan Baris ke-',baris,' dan kolom ke-',kolom,' = ');readln(matA[baris,kolom]);
end;
writeln('=====================================');
writeln;
begin
writeln('==============');
writeln('|| Matrik B ||');
writeln('==============');
write('Masukan Baris = ');readln(baris);
write('Masukan Kolom = ');readln(kolom);
writeln('=================');
for baris:=1 to baris do
for kolom:=1 to kolom do
begin
write('Inputkan Baris ke-',baris,' dan kolom ke-',kolom,' = ');readln(matB[baris,kolom]);
end;
begin
clrscr;
writeln('==============');
writeln('|| Matrik A ||');
writeln('==============');
for baris:=1 to baris do
begin
for kolom:=1 to kolom do
write(matA[baris,kolom]:5);
writeln(' ');
end;
writeln('==============');
writeln('==============');
end;
begin
writeln;
writeln('==============');
writeln('|| Matrik B ||');
writeln('==============');
for baris:=1 to baris do
begin
for kolom:=1 to kolom do
write(matB[baris,kolom]:5);
writeln(' ');
end;
writeln('==============');
writeln('==============');
end;
end;
begin
writeln;
for baris:=1 to baris do
begin
for kolom:=1 to kolom do
matC[baris,kolom]:=matA[baris,kolom]+matB[baris,kolom];
end;
begin
writeln('=======================');
writeln('|| Hasil Penjumlahan ||');
writeln('=======================');
for baris:=1 to baris do
begin
for kolom:=1 to kolom do
write(matC[baris,kolom]:5);
writeln;
end;
writeln('=======================');
writeln('=======================');
end;
end;
end.
Tidak ada komentar:
Posting Komentar
W A R N I N G !!!
=Pembaca yang Baik selalu Meninggalkan Komentar=
~ Berkomentarlah secara baik dan sopan maka admin akan merespon
~ JANGAN ANONIM
~ Komentar Sesuai dengan Topik Pembicaraan
~ Tidak Menyertakan Link Aktif
~ Dilarang Promosi dalam Bentuk Apapun !