Напишите программу на языке Pascal.Элементы массива А, удовлетворяющие условию А(i)>5.5, переписать в массив В, а элементы, удовлетворяющие условию А(i)<=5.5, переписать в массив С. В массиве А m элементов.
program SeparateArrays; var A, B, C: array of Real; m, i, countB, countC: Integer; begin Write′EnterthenumberofelementsinarrayA:′'Enter the number of elements in array A: '′EnterthenumberofelementsinarrayA:′; ReadLnmmm;
SetLengthA,mA, mA,m;
WriteLn′EntertheelementsofarrayA:′'Enter the elements of array A:'′EntertheelementsofarrayA:′; for i := 0 to m - 1 do begin ReadLnA[i]A[i]A[i]; if Aiii > 5.5 then countB := countB + 1 else countC := countC + 1; end;
for i := 0 to m - 1 do begin if Aiii > 5.5 then begin BcountBcountBcountB := Aiii; countB := countB + 1; end else begin CcountCcountCcountC := Aiii; countC := countC + 1; end; end;
WriteLn′ElementsofarrayB:′'Elements of array B:'′ElementsofarrayB:′; for i := 0 to LengthBBB - 1 do WriteLnB[i]B[i]B[i];
WriteLn′ElementsofarrayC:′'Elements of array C:'′ElementsofarrayC:′; for i := 0 to LengthCCC - 1 do WriteLnC[i]C[i]C[i]; end.
program SeparateArrays;
var
A, B, C: array of Real;
m, i, countB, countC: Integer;
begin
Write′EnterthenumberofelementsinarrayA:′'Enter the number of elements in array A: '′EnterthenumberofelementsinarrayA:′;
ReadLnmmm;
SetLengthA,mA, mA,m;
WriteLn′EntertheelementsofarrayA:′'Enter the elements of array A:'′EntertheelementsofarrayA:′;
for i := 0 to m - 1 do
begin
ReadLnA[i]A[i]A[i];
if Aiii > 5.5 then
countB := countB + 1
else
countC := countC + 1;
end;
SetLengthB,countBB, countBB,countB;
SetLengthC,countCC, countCC,countC;
countB := 0;
countC := 0;
for i := 0 to m - 1 do
begin
if Aiii > 5.5 then
begin
BcountBcountBcountB := Aiii;
countB := countB + 1;
end
else
begin
CcountCcountCcountC := Aiii;
countC := countC + 1;
end;
end;
WriteLn′ElementsofarrayB:′'Elements of array B:'′ElementsofarrayB:′;
for i := 0 to LengthBBB - 1 do
WriteLnB[i]B[i]B[i];
WriteLn′ElementsofarrayC:′'Elements of array C:'′ElementsofarrayC:′;
for i := 0 to LengthCCC - 1 do
WriteLnC[i]C[i]C[i];
end.