1)
var X:array[12] of real;
i: integer;
begin
for i:=1 to 12 do
begin
readln(X[i]);
X[i]:=X[i]-23;
end;
for i:=1 to 12 do
writeln(X[i])
end.
2)
var M:array[100] of integer;
i: integer;
begin
for i:=1 to 100 do begin
readln(M[i]);
if(M[i] mod 2=0) then M[i]:=M[i]*M[i]
else M[i]=2*M[i];
end;
for i:=1 to 100 do
writeln(M[i]);
end.
3)
var price:array[20] of real;
i:integer;
minprice:real;
begin
minprice:=10000;
for i:=1 to 20 do
begin
readln(price[i]);
if (price[i]<minprice) then minprice:=price[i];
end;
writeln(minprice)
end.
4)
var M:array[100] of integer;
i, counter: integer;
begin
readln(M[1]);
counter:=0;
for i:=2 to 100 do begin
readln(M[i]);
if ((M[i] mod 2=1) and (M[i-1] mod 2=1)) then inc(counter);
end;
writeln(counter)
end.
var a:array of integer;
i,n:integer;
begin
writeln('Число элементов массива ');
readln(n);
setlength(a,n+1);
for i:=1 to n do begin
if a[i]<>i mod 2 then a[i]:=1 else a[i]:=-1;
writeln('a(',i,')= ',a[i]);
end;
end.
Тестовое решение:
Число элементов массива
10
a(1)= 1
a(2)= -1
a(3)= 1
a(4)= -1
a(5)= 1
a(6)= -1
a(7)= 1
a(8)= -1
a(9)= 1
a(10)= -1