Advertisement
Alex_Fomin

Untitled

Dec 21st, 2015
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.61 KB | None | 0 0
  1. begin
  2.   var n := ReadLnInteger('Введите размер массива:');
  3.   var arr := new integer[n];
  4.   for var i := 0 to arr.Length - 1 do arr[i] := ReadLnInteger('Введите ' + Succ(i) + '-ый элемент массива:');
  5.   WriteLn('Исходный массив:', newLine, arr);
  6.   if arr.Where(x -> x < 0).Count <> 0 then
  7.   begin
  8.     var brr := new integer[arr.Where(x -> x < 0).Count];
  9.     brr := arr.Where(x -> x < 0).ToArray;
  10.     WriteLn('Сформированный массив:', newLine, brr);
  11.   end
  12.   else WriteLn('Отрицательных элементов нет :(');
  13. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement