Advertisement
Alex_Fomin

Untitled

Dec 23rd, 2015
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.49 KB | None | 0 0
  1. begin
  2.   var arr := new integer[ReadLnInteger('Введите размер массива:')];
  3.   for var i := 0 to arr.Length - 1 do arr[i] := Random(51) - 25;
  4.   Writeln('Исходный массив:', newLine, arr);  
  5.   var temp := arr.Where(x -> x > 0).Max;
  6.   arr.SetValue(arr.Where(x -> x < 0).Max, System.Array.IndexOf(arr, arr.Where(x -> x > 0).Max));
  7.   arr.SetValue(temp, System.Array.IndexOf(arr, arr.Where(x -> x < 0).Max));
  8.   Writeln('Новый массив:', newLine, arr);
  9. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement