//з № 1var s,d,f,max:integer;beginRead(s,d,f);if (s > d)and (s > f) thenmax:= selse if (d > s) and (d > f) thenmax:= delse if (f > d) and(f > s) then max:=f;write('max ',max);end.
//з № 2 var x:real; r:integer;beginwrite('Введите число x =');Read(x);if Frac(x)=0 then beginwriteln('x - целое число!');r:=round(x);if ((r mod 2)=0) then writeln('Число четное')else writeln('Число нечетное');endelse writeln('x - дробное число!')end.
//з № 3var a:integer;beginwrite('Введите число а =');Read(a);if (a > 0)and (a <= 5) thena:= a *a*aelse if (a > 5) thena:= a*aelsea:=a;write('a = ',a);end.
Объяснение:
const n=5; m=6;
var
v:array[1..n,1..m] of integer;
b:array[1..n] of integer;
i,j,max:integer;
begin
Randomize;
writeln('Исходный массив:');
for i:=1 to n do
begin
for j:=1 to m do
begin
v[i,j]:=random(100)-50;
write(v[i,j]:4);
end;
writeln;
end;
for i:=1 to n do
begin
max:=0;
for j:=1 to m do
if (v[i,j]>0)and(v[i,j]>max) then max:=v[i,j];
b[i]:=max;
end;
writeln('Полученный массив:');
for i:=1 to n do write(b[i],' ');
end.
Пример:
Исходный массив:
19 12 -23 -40 -1 9
-42 18 -6 -13 -24 -31
22 26 -31 32 22 -8
-22 -7 20 0 48 35
-22 34 -46 -44 -48 -29
Полученный массив:
19 18 32 48 34