using System;
class Program
{
static void Main()
{
var a = new int[10];
var r = new Random();
Console.WriteLine("Массив a:");
for (int i = 0; i < a.Length; i++)
{
a[i] = r.Next(-20, 20);
Console.Write("{0,5}", a[i]);
}
Console.WriteLine();
var max = a[0];
foreach (var element in a) {
max = (element > max) ? element : max;
}
Console.WriteLine("max = {0}", max);
Console.ReadKey();
}
}