Pascal Örnekleri 15 ( Çift Boyutlu Diziler)

ÇİFT BOYUTLU DİZİLER (MATRİS)

Matris1

uses crt;
var
sayi1:array[1..5,1..6] of integer;sayi2:array[1..5,1..6] of integer;
toplam:array[1..5,1..6] of integer;
i,j:byte;
begin clrscr;
randomize;
for i:=1 to 5 do begin
for j:=1 to 6 do begin
sayi1[i,j]:=random(100);
sayi2[i,j]:=random(100);
toplam[i,j]:=sayi1[i,j]+sayi2[i,j];
write(toplam[i,j]:5);
end;
writeln(”);
end;
readln;
end.

Matris2

uses crt;
var
sayi:array[1..3,1..3] of integer;
sayi1:array[1..3,1..3] of integer;
carpim:array[1..3,1..3] of integer;
sonuc:integer;
a,i,j,k:byte;
begin randomize; clrscr;
writeln(”);
for i:=1 to 3 do begin
for j:=1 to 3 do begin
sayi[i,j]:=random(10);
write(sayi[i,j]:6);end;write(”);end;
writeln(”);
for i:=1 to 3 do begin
for j:=1 to 3 do begin
sayi1[i,j]:=random(10);
write(sayi1[i,j]:6); end;
writeln(”); end;
writeln(”);
for i:=1 to 3 do begin
for j:=1 to 3 do begin
for k:=1 to 3 do begin
carpim[j,i]:=sayi[j,k]*sayi1[k,i]+carpim[j,i];
end;
write(carpim[j,i]:6);
end;
writeln(”);
end;
readln;
end.

Küçükten büyüğe doğru loto programı

uses crt;
var
loto:array[1..8,1..6] of integer;
k,l,i,j,m:byte;
degisken:integer;
begin clrscr;
randomize;
for i:=1 to 8 do begin
for j:=1 to 6 do
loto[i,j]:=random(48);
for k:=1 to  5 do
for l:=k+1 to 6 do
if loto[i,k]>loto[i,l] then begin
degisken:=loto[i,k];
loto[i,k]:=loto[i,l];
loto[i,l]:=degisken;
end;
for m:=1 to 6 do
write(‘  <‘,loto[i,m]:10);
writeln(”);
end;
readln;
end.

Transpoz

uses crt;
var
sayi:array[1..3,1..3] of integer;
i,j:byte;
begin clrscr; randomize;
writeln(”);
for i:=1 to 3 do begin
for j:=1 to 3 do begin
sayi[i,j]:=random(100);
write(sayi[i,j]:6);
writeln(”); end;
writeln(”); end;
for i:=1 to 3 do begin
for j:=1 to 3 do begin
write(sayi[j,i]:6); end;
writeln(”); end;
readln;
end.

Yazar: kacarozgur

Özgür Kaçar sitemizde 38 yazı eklemiş...

Share