Print minimum of [6, 5, 4, 3, 2, 1].
| Test | Status | Details |
|---|
Ready — edit the code above and click Run or Submit.
using System;
class Program
{
static void Main()
{
int[] a = { 6, 5, 4, 3, 2, 1 };
int min = a[0];
foreach (var x in a) if (x < min) min = x;
Console.WriteLine(min);
}
}
Try solving on your own first, then reveal the official answer.
Linear scan for min/max.