Первое
Код:
Program DZ1; type matr=array[1..6,1..6] of real; var a,b,c,d,e:matr; i,j:byte; p,max,min,o:real; q,k,l:integer; Procedure vivod (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 6 do For j:=1 to 6 do a[i,j]:=sqr(i)+j*sin(i)/cos(i); vivod ('A',a,2); b:=a; max:=b[1,1]; min:=b[1,1]; For i:=1 to 6 do for j:=1 to 6 do Begin if max<b[i,j] then Begin max:=b[i,j]; l:=i; end; if min>b[i,j] then begin min:=b[i,j]; k:=i; end; end; For i:=1 to 6 do for j:=1 to 6 do Begin if i=l then b[i,j]:=a[k,j]; if i=k then b[i,j]:=a[l,j]; end; begin If(b[i,j]>b[i,k]) then begin p:=b[i,j]; b[i,j]:=b[i,k]; b[i,k]:=p; end; end; vivod('B',b,2); for i:=1 to 6 do for j:=1 to 6 do c[i,j]:=0; for i:=1 to 6 do for j:=1 to 6 do Begin if (j>i) or (i=j) then c[i,j]:=6; end; vivod('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; vivod('D',d,2); e:=d; For i:=3 to 4 do For j:=1 to 2 do e[i,j]:=d[i-2,j+2]; For i:=1 to 2 do For j:=3 to 4 do e[i,j]:=d[i+2,j-2]; vivod('E',e,2); max:=0; o:=0; For j:=1 to 6 do Begin For i:=1 to 6 do o:=o+e[i,j]; if max<o then Begin max:=o; k:=j; end; end; write('Stroka s naibolshey summoy = ',k:2); readln; end.
Второе
Код:
Program DZ2; const ni=9; mj=10; lk=8; 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:=sqrt(x*y)/sqrt(sqr(x)+2*x*y+y); end; function p(r:integer):real; begin if r=1 then p:=sqrt(z) else p:=p(r-1)+2*p(r-1)/z; end; function h(r:integer):real; begin if r=1 then h:=cos(2) else h:=h(r-1)+sqr(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 ms[r]>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(s+sqr(t),t)+f(s,t); b:=f(s+5,t+5)/(t+5)+f(s,t); writeln('a = ',a:5:2,' b = ',b:5:2); write('Vvedite z: '); readln(z); c:=sqr(p(4))/h(4); 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.