Program samost; const n=5; m=5; type tmatr = array[1..n, 1..m] of integer; var a:tmatr; i,j,k:integer; procedure PrintMatrix(var g:tmatr); begin var i,j:integer; for i:=1 to n do begin for j:=1 to n do write(g[i,j]:4); writeln end; end; procedure MakeMatrix; begin var i,j,k:integer; randomize; for i:=1 to n do for j:=1 to n do begin a[i,j]:=random(10)-5; end; end; begin MakeMatrix; writeln('matrica A: '); PrintMatrix(a); k:=0; for i:=1 to n do for j:=2 to m-1 do begin
if (a[i,j]>a[i,j-1])and(a[i,j]<a[i,j+1]) then begin k:=k+1; ; writeln(i,j); end; end; writeln('kolichestvo elementov = ',k); end.
uses crt;
var a, b, c: integer;
u, p, s: real;
begin
clrscr;
write ('vvedite kolichestvo udobrenii, nuzhnyh dlya 1 m^2: ');
readln (u);
write ('vvedite storony uchastka: '); // таким образом можно ввести любые
// стороны, не только 3, 4 и 5
readln (a, b, c);
// можно сразу написать a:=4; b:=3; c:=5;
p:=a+b+c;
writeln (' dlina ogrady - ', p:0:2);
p:=p/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c)); // вычисление площади по формуле Герона
u:=u*s;
writeln ('kolichestvo trebuemyh udobrenii - ', u:0:2);
readkey;
end.
const n=5;
m=5;
type tmatr = array[1..n, 1..m] of integer;
var a:tmatr;
i,j,k:integer;
procedure PrintMatrix(var g:tmatr);
begin
var i,j:integer;
for i:=1 to n do
begin
for j:=1 to n do
write(g[i,j]:4);
writeln
end;
end;
procedure MakeMatrix;
begin
var i,j,k:integer;
randomize;
for i:=1 to n do
for j:=1 to n do
begin
a[i,j]:=random(10)-5;
end;
end;
begin
MakeMatrix;
writeln('matrica A: ');
PrintMatrix(a);
k:=0;
for i:=1 to n do
for j:=2 to m-1 do
begin
if (a[i,j]>a[i,j-1])and(a[i,j]<a[i,j+1]) then
begin
k:=k+1; ;
writeln(i,j);
end;
end;
writeln('kolichestvo elementov = ',k);
end.