C# 程序查找数组中最小元素
声明数组 -
int[] arr = { 5, 9, 2, 7 };现在要从数组中获得最小元素,请使用 Min() 方法 -
arr.Min());
以下是完整的代码 -
示例
using System;
using System.Linq;
class Demo {
static void Main() {
int[] arr = { 5, 9, 2, 7 };
Console.WriteLine(arr.Min());
}
}输出
2
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP