using System;
using System.Linq;
class HelloWorld
{
    static void Main()
    {
        // nekas intersantu, parasti tiek izvaditi mainigie
        string vards = ("Maksims");
        vards = vards.ToUpper();
        string uzvards = ("Gutovs");
        uzvards = uzvards.ToLower();
        Console.WriteLine("Mans vards ir " + vards + " un taja ir " + vards.Length + " simboli");
        Console.WriteLine("Mans uzvards ir " + uzvards + " un taja ir " + uzvards.Length + " simboli");
        // atkraiba no varda garuma noteikts cik gara bus linija tabulai
        for (int i = 0; i <= vards.Length + 4; i++)
        {
            Console.Write("+---------------");
        }
        Console.WriteLine("+");
        // seit ik veidota pirma tabulas rinda
        Console.Write("|\tx\t");
        for (int i = 0; i <= vards.Length - 1; i++)
        {
            Console.Write($"|\t{vards[i]}\t");
        }
        Console.WriteLine("|\tmax\t|\tmin\t|\tvid\t|\tsum\t|");
        for (int i = 0; i <= vards.Length + 4; i++)
        {
            Console.Write("+---------------");
        }
        Console.WriteLine("+");
        // noteikts cik jabut skailtu
        int[] skailti = new int[vards.Length];
        Random rnd = new Random();
        // vissi dati no 2 rindas
        for (int j = 0; j <= uzvards.Length-1; j++)
        {
            Console.Write($"|\t{uzvards[j]}\t"); // katra rinda tiek izvadita uzvarda burta atkraiba no iteracijas
            for (int i = 0; i <= vards.Length - 1; i++)
            {
                
                skailti[i] = rnd.Next(vards.Length, vards.Length + uzvards.Length + 1); // ar katru janu rindu massivs tiek aizpildits ar jauniem random slaitliem
                Console.Write($"|\t{skailti[i]}\t");
            }
            // tiek izvadits max, min, vid un sum lietojot Linq
            Console.Write($"|\t{skailti.Max()}\t");
            Console.Write($"|\t{skailti.Min()}\t");
            Console.Write($"|\t{Math.Round(skailti.Average(), 1)}\t");
            Console.WriteLine($"|\t{skailti.Sum()}\t|");
            for (int i = 0; i <= vards.Length + 4; i++)
            {
                Console.Write("+---------------");
            }
            Console.WriteLine("+");
        }

    }
}