using System;
using System.Collections.Generic;

public class HelloWorld
{
    public static void Main()
    {
        Uzd1();
        Uzd2();
        Uzd3();
        Uzd4();
        Uzd5();
    }
    public static void Uzd1()
    {
        int[,] numbers = { {1, 4, 2, 5}, {2, 3, 6, 8}, {9, 6, 7, 9} };
        for (int i = 0; i < numbers.GetLength(0); i++) {
            for (int j = 0; j < numbers.GetLength(1); j++) {
                Console.Write("\t" + numbers[i, j]);
            }
            Console.WriteLine();
        }
}
    public static void Uzd2()
    {
        int[][] sk = { 
            new int[] {1, 4},
            new int[] {2, 3, 8},
            new int[] {9, 6, 7, 9}
        };
        for (int i = 0; i < sk.GetLength(0); i++) {
            for (int j = 0; j < sk[i].Length; j++) {
                Console.Write("\t" + sk[i][j]);
            }
            Console.WriteLine();
            }
}
     public static void Uzd3()
    {
        int rs = 0;
        int[,] numbers = { {1, 4, 2, 5, 3}, {2, 3, 6, 8, 4}, {9, 6, 7, 9, 5}, {5, 7, 1, 2, 0} };
        for (int i = 0; i < numbers.GetLength(0); i++) {
            rs = 0;
            for (int j = 0; j < numbers.GetLength(1); j++) {
                rs = rs + numbers[i, j];
                }
                Console.WriteLine("\t"+(i+1)+". Rindas summa = " + rs);
                }
        Console.WriteLine();
        }
    public static void Uzd4()
    {
        int[][] sk = 
        { 
            new int[] {1, 4},
            new int[] {2, 3, 8},
            new int[] {9, 6, 7, 9}
        };
        Console.WriteLine("Ievadiet jebkuru veselu skaitli no 1-10!");
        int x = Convert.ToInt32(Console.ReadLine());
        for (int i = 0; i < sk.GetLength(0); i++) {
            for (int j = 0; j < sk[i].Length; j++) {
                if (sk[i][j] == x) {
                    Console.WriteLine($"Veselais skaitlis {x} atrodas Rinda:{i+1} Kolona:{j+1} ");
            }
            }
        }
}
    public static void Uzd5()
        {
            int[][] sk = 
            { 
                new int[] {4, 1},
                new int[] {8, 3, 2},
                new int[] {0, 9, 7, 6}
            };
            for (int i = 0; i < sk.GetLength(0); i++) {
                Array.Sort(sk[i]);
            }
            for (int i = 0; i < sk.Length; i++) {
                Console.WriteLine($"[{string.Join(",",sk[i])}]");
            }
    }
}
