Ikki o‘lchovli massiv elementlarini kompyuter xotirasiga kiritish va chiqarish. Ikki o‘lchovli massivlar elementlarini kiritish yoki chiqarish quyidagicha amalga oshiriladi:
Masalan:
A matritsa (i,j=1...3) elementlari quyidagicha kiritiladi:
for i:=1 to 3 do
for j:=1 to 3 do
read (A[i,j]);
V matritsa (i,j=1...3) elementlari quyidagicha chiqariladi:
for i:=1 to 3 do
for j:=1 to 3 do
write (B[i,j]);
Misol. A matritsaning elementlarini quyidagi formula orqali aniqlang.
A matritsaning har bir elementini A matritsaning normasiga bo‘lib V
matritsani hosil qiling, ya’ni
PASKAL algoritmik tilidagi dastur matni:
Program Massiv( input,output);
var a,b:array[1..3,1..3] of real;
i,j:integer;
begin
for i:=1 to 3 do begin
for j:=1 to 3 do
a[i,j]:=(ln(abs(i+j*j*j)))/(exp(1/3)*ln(i*i*i+j));
end;
s:=0;
for i:=1 to 3 do begin
for j:=1 to 3 do
s:=s+sqr(a[i,j]);
end;
for i:=1 to 3 do begin
for j:=1 to 3 do
b[i,j]:=a[i,j]/sqr(s);
Writeln(‘B(‘,i,’,’,j,’)=‘,b[i,j]);
end;
end.
Do'stlaringiz bilan baham: |