📌  相关文章
📜  如何在数组c#代码示例中四舍五入到最接近的数字

📅  最后修改于: 2022-03-11 14:48:52.539000             🧑  作者: Mango

代码示例1
int[] array = {5,7,8,15,20};
int TargetNumber = 13;

var nearest = array.OrderBy(x => Math.Abs((long) x - targetNumber)).First();

//output = 15