Первая
Код:
Program DZ1; type matr=array[1..7,1..6] of real; var a,b,c,d,e:matr; i,j,k:byte; p,max,w:real; q,s:integer; Procedure vivod (ch:char;M:MATR;N:byte); Begin writeln ('Matrica ',ch); For i:=1 to 7 do Begin For j:=1 to 6 do write(m[i,j]:8:n); writeln end; readln end; Procedure vivod1 (ch:char;M:MATR;N:byte); Begin writeln ('Matrica ',ch); For i:=1 to 6 do Begin For j:=1 to 6 do write(m[i,j]:8:n); writeln end; readln end; Begin For i:=1 to 7 do For j:=1 to 6 do a[i,j]:=sqr(i)+j/cos(i); vivod ('A',a,2); max:=a[1,1]; For i:=1 to 7 do for j:=1 to 6 do if max<a[i,j] then Begin s:=i; max:=a[i,j]; end; writeln('Maxsimalniy element v stroke',s:2); For i:=1 to 7 do for j:=1 to 6 do If s>i then b[i,j]:=a[i,j] else b[i,j]:=a[i+1,j]; vivod1('B',b,2); for i:=1 to 6 do for j:=1 to 6 do c[i,j]:=i; vivod1('C',c,2); for i:=1 to 6 do for j:=1 to 6 do begin d[i,j]:=0; for k:=1 to 6 do d[i,j]:=d[i,j]+b[i,k]*c[k,j]; end; vivod1('D',d,2); e:=d; For i:=3 to 4 do For j:=1 to 2 do e[i,j]:=d[i,j+4]; For i:=3 to 4 do For j:=5 to 6 do e[i,j]:=d[i,j-4]; vivod1('E',e,2); max:=0; w:=0; For i:=1 to 6 do For j:=1 to 6 do if e[i,j]>0 then Begin max:=max+e[i,j]; w:=w+1; end; max:=max/w; write('Srednearifmet polozitelnih elementov= ',max:2:2); readln; end.
Вторая
Код:
Program DZ2; const ni=8; mj=9; lk=10; type mas = array [1..15] of real; var s,t,a,b,z,c:real; n,m,l:mas; i,j,k,r:integer; function f(x,y:real):real; begin f:=(2*x+sqr(y)+3)/6; end; function p(r:integer):real; begin if r=1 then p:=sin(2) else p:=p(r-1)+sqr(p(r-1))/z; end; function h(r:integer):real; begin if r=1 then h:=sqrt(z) else h:=h(r-1)+2*h(r-1)/z; end; procedure s_m(si:integer;var ms:mas;Sm:char); begin writeln('Ischodniy Massiv ',Sm); for r:=1 to si do begin ms[r]:=random(5)-r; write(ms[r]:3:0); end; readln; writeln; end; procedure deyst(si:integer;ms:mas;Sm:char;abc:real); begin writeln('Polu4eniy Massiv ',Sm); for r:=1 to si do begin if frac(ms[r]/2)=0 then Begin ms[r]:=ms[r]*abc; end; write(ms[r]:7:2); end; readln; writeln; end; Begin randomize; write('Vvedite s,t: '); readln(s,t); a:=f(t,s); b:=f(sqrt(t),sqrt(s)); writeln('a = ',a:5:2,' b = ',b:5:2); write('Vvedite z: '); readln(z); c:=sqrt(abs(h(5)-z))/p(5); writeln('c = ',c:6:2); s_m(ni,n,'N'); s_m(mj,m,'M'); s_m(lk,l,'L'); deyst(ni,n,'N',a); deyst(mj,m,'M',b); deyst(lk,l,'L',c); readln End.