===== PascalABC.NET =====
begin
var n := ReadInteger('n =');
var a := ArrRandomReal(n, -10, 10);
a.Println;
var x := ReadReal('Что ищем?');
var m := a.Select((v, i) -> (Abs(v - x), i)).MinBy(p -> p[0])[1];
Println(a[m]);
end.
===== PascalABC.NET =====
begin
var n := ReadInteger('n =');
var a := ArrRandomReal(n, -10, 10);
a.Println;
var x := ReadReal('Что ищем?');
var m := a.Select((v, i) -> (Abs(v - x), i)).MinBy(p -> p[0])[1];
Println(a[m]);
end.