/*
Veidotajs: Sorecs Andrejs
Grupa: 110
Praktiskais darbs: 5
Izmantotais Compiler: Visual Studio
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _30._10.mst
{
    internal class Program
    {
        static void Main()
        {
            //Uzd1();
            //Uzd2();
            //Uzd3();
            //Uzd4();
            //Uzd5();
            uzd6();
           // Mains1();
            Console.ReadKey();
        }
        public static void Uzd1()
        {
            int[,] ciparini = { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 } };
            for (int i = 0;i<ciparini.GetLength(0);i++)
            {
                Console.Write("Rinda{0}", 1+i);
                for (int j = 0;j<ciparini.GetLength(1);j++)
                {
                    Console.Write("\t"+ ciparini[i,j]);
                }
                Console.WriteLine();
            }
        }
        public static void Uzd2()
        {
            int[][] cip = {new int[] {1,2 }, new int[] {3,4,5 },new int[] { 6 } };
            foreach (int[] cipRows in cip)
            {
                Console.Write("\t");
                for (int i = 0; i < cipRows.Length; i++)
                {
                    Console.Write(cipRows[i] +"\t");
                }
                Console.WriteLine();
            }
        }
        public static void Uzd3()
        {
            int[,] cipsum = { { 1,2,3,4,5 },{6,7,8,9,10 },{11,12,13,14,15 },{16,17,18,19,20 } };
            for (int i = 0;i < cipsum.GetLength(0);i++)
            {
                Console.Write("Rinda{0}",+i);
                int sum = 0;
                for (int j = 0;j < cipsum.GetLength(1); j++)
                {
                    sum= sum+cipsum[i,j];
                    Console.Write("\t" + cipsum[i,j]);
                }
                Console.WriteLine("\t summa:"+ sum);
            }
        }
        public static void Uzd4()
        {
            int[][] cipar = { new int[] {1,2,3,4},new int[] {5,6,7},new int[] {8,9} };
            Console.Write("Ievadiet ciparu: ");
            string cp =Console.ReadLine();
            if (int.TryParse(cp,out int mekcp))
            {
                bool mekl = false;
                for (int i = 0; i < cipar.Length; i++)
                {
                    for (int j = 0; j < cipar[i].Length; j++)
                    {
                        if (cipar[i][j] == mekcp)
                        {
                            Console.WriteLine($"Cipars {mekcp} atrasts pozicjia: Rinda [{i}], Kolona[{j}]");
                            mekl = true;
                        }
                    }
                }
                if (!mekl)
                {
                    Console.WriteLine("Cipars nebij atrasts!");
                }
            }
        }
        public static void Uzd5()
        {
            int[][] sk = {
                new int[] {7,6,5},
                new int[] {3,2,1},
                new int[] {9, 4, 8 }
            };

            for (int i = 0; i < sk.Length; i++)
            {
                Console.Write("\t");
                for (int j = 0; j < sk[i].Length; j++)
                {
                    Console.Write(sk[i][j] + " ");
                }
                Console.WriteLine();
            }
            for (int k=0; k<sk.Length; k++)
            {
                int[]ssk =sk[k];
                Array.Sort(ssk);
                sk[k] = ssk;
            }
            Console.WriteLine() ;

            for (int i = 0; i < sk.Length; i++)
            {
                Console.Write("\t");
                for (int j = 0; j < sk[i].Length; j++)
                {
                    Console.Write(sk[i][j] + " ");
                }
                Console.WriteLine();
            }

        }
        public static void uzd6()
        {

            int[,] sk = { {1,2,3,4,5 }, {6,4,8,9,2 }, {9,6,2,0,1 } };

            for (int i = 0; i < sk.GetLength(0); i++)
            {
                Console.Write("Rinda{0}:",1+i);
                Console.Write("\t");
                for (int j = 0; j < sk.GetLength(1); j++)
                {
                    Console.Write("\t"+ sk[i,j]);
                }
                Console.WriteLine();
            }
        }

    }
}