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