Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Uses SysUtils;
- Var FirstArr, SecondArr : array of Integer;
- I, N, Amount: Integer;
- IsCorrect : Boolean;
- Begin
- Write('Введите длину массива: ');
- Repeat
- IsCorrect := True;
- Try
- Readln(N);
- Except
- Writeln('Введите целое число!');
- IsCorrect := False;
- End;
- If ((N < 1) or (N > 20)) and IsCorrect then
- Begin
- Writeln('Введите натуральное число в диапозоне от 1 до 20');
- IsCorrect := False;
- End;
- Until (IsCorrect);
- SetLength(FirstArr, N);
- SetLength(SecondArr, N);
- Dec(N);
- For I := 0 to N do
- Begin
- Repeat
- Iscorrect := True;
- Writeln('Введите элемент массива под номером', ' ' , I+1);
- try
- Readln(FirstArr[I]);
- except
- Writeln('Введите целое число');
- IsCorrect := False;
- end;
- Until (IsCorrect);
- End;
- Amount := 1;
- For I := 0 to N do
- If (FirstArr[I] mod 2 = 0) then
- Begin
- SecondArr[Amount] := FirstArr[I];
- Amount := Amount + 1;
- End;
- For I := 0 to N do
- If (FirstArr[I] mod 2<>0) then
- Begin
- SecondArr[Amount] := FirstArr[I];
- Amount := Amount + 1;
- End;
- Writeln('Изменённый массив ');
- for I := 1 to Amount - 1 do
- Write(SecondArr[I], ' ');
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement