Program ArrayDuaDimensi2;
uses wincrt;
Var
matrik1,matrik2:array[1..2,1..2] of byte;
hkurang,htambah:array[1..2,1..2] of integer;
b,k:byte;
procedure inputmatrik;
begin
writeln('Input Isi Matrik 1 ');
for b:= 1 to 2 do begin
for k:= 1 to 2 do begin
write('Isi Matrik Baris ',b,' Kolom ',k,' = ');
readln(matrik1[b,k]);
end;
end;
writeln('Input Isi Matrik 2 ');
for b:= 1 to 2 do begin
for k:= 1 to 2 do begin
write('Isi Matrik Baris ',b,' Kolom ',k,' = ');
readln(matrik2[b,k]);
end;
end;
end;
procedure tambahmatrik;
begin
for b:= 1 to 2 do begin
for k:= 1 to 2 do begin
htambah[b,k]:=matrik1[b,k]+matrik2[b,k];
end;
end;
end;
procedure kurangmatrik;
begin
for b:= 1 to 2 do begin
for k:= 1 to 2 do begin
hkurang[b,k]:=matrik1[b,k]-matrik2[b,k];
end;
end;
end;
procedure CetakMatrik;
begin
clrscr;
writeln('Isi Matrik 1 ');
for b:= 1 to 2 do begin
for k:= 1 to 2 do begin
write(matrik1[b,k]:4);
end;
writeln;
end;
write('tekan enter untuk melihat isi matrik 2');
readln;
writeln;
writeln('Isi Matrik 2 ');
for b:= 1 to 2 do begin
for k:= 1 to 2 do begin
write(matrik2[b,k]:4);
end;
writeln;
end;
write('tekan enter untuk melihat hasil penjumlahan');
readln;
writeln;
writeln('Hasil Penjumlahan ');
for b:= 1 to 2 do begin
for k:= 1 to 2 do begin
write(htambah[b,k]:4);
end;
writeln;
end;
write('tekan enter untuk melihat hasil pengurangan');
readln;
writeln;
writeln('Hasil pengurangan ');
for b:= 1 to 2 do begin
for k:= 1 to 2 do begin
write(hkurang[b,k]:4);
end;
writeln;
end;
writeln;
write('tekan enter untuk keluar');
readln;
end;
{Program Utama}
begin
inputmatrik;
tambahmatrik;
kurangmatrik;
cetakmatrik;
End.
Saturday, July 14, 2012
PROGRAM PENJUMLAHAN DAN PENGURANGAN MATRIK (ARRAY DUA DIMENSI) MENGGUNAKAN BAHASA PEMROGRAMAN PASCAL
Categories: CODING BAHASA PEMROGRAMAN
Related Posts:
PROGRAM PASCAL FAKTORIAL BILANGAN DENGAN MENGGUNAKAN FUNCTION PROGRAM BILANGAN_FAKTORIAL_FUNCTION; USES WINCRT; FUNCTION FAKTORIAL (B:INTEGER):INTEGER; VAR I,HSL:INTEGER; BEGIN CLRSCR; HSL:=1; FOR I:=B DOWNTO 1 DO HSL:=HSL*I; FAKTORIAL:=HSL; … Read More
PROGRAM INPUT MATRIK ARRAY MENGGUNAKAN BAHASA PEMROGRAMAN PASCALProgram InputMatrik; Uses Wincrt; Type Matrik=array[1..100,1..100] of integer; Var matriku:matrik; b,k,baris,kolom:integer; begin {Kode membatasi input <= 100} … Read More
Program Tebak Perkalian dengan Visual BasicOption Explicit Dim kali As Integer Dim angkaprob As Integer, angkabetul As Integer Private Sub command1_Click() Dim angka1 As Integer Dim angka2 As Integer Text1.Text = "" Label7.Caption = "" angkaprob = angkaprob + 1 angka… Read More
PROGRAM MENGHITUNG BILANGAN PANGKAT MENGGUNAKAN BAHASA PEMROGRAMAN PASCALuses wincrt; var hasil,i,bil,pangkat:integer; begin clrscr; write('Input Bilangan = '); readln(bil); write('Input pangkat = '); &nbs… Read More
PROGRAM MENGHITUNG PANGKAT DENGAN VISUAL BASIC TAMPILAN PROGRAM MENGHITUNG PANGKAT KODE PROGRAM Option Explicit Dim X As Integer Dim Y As Integer Dim HSL As Long Dim I As Byte Private Sub Command1_Click()… Read More
Subscribe to:
Post Comments (Atom)
makasi y
ReplyDeletesama2...
Delete