/*
    Veidoja: Maksimilians Lukjanskis
    Grupa: 110
    Praktiskais darbs 7 ( uzd 2)
    Izmantotais compiler: https://www.programiz.com/csharp-programming/online-compiler/
*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

public class OtraisUzdevums
{
    
    public static void Main()
    {
        string[,] noliktava = new string[,]
    {
        {"11","21","31","41"},
        {"12","22","32",""},
    };
    string rezultats = AtklatPreci(noliktava);
    Console.WriteLine(rezultats);
    string tuks = AprekinatNeaizpilditas(noliktava);
    Console.WriteLine(tuks);
    }
    static string AtklatPreci(string [,] noliktava){
        Console.WriteLine("Ievadiet preces kodu kuru gribat parbaudit");
        int x = Convert.ToInt32(Console.ReadLine());
        for(int i =0; i<noliktava.GetLength(0);i++){
            for(int j =0; j<noliktava.GetLength(1);j++){
                if(noliktava[i,j]==x.ToString()){
                    return $"Prece {x} atrodas Eja:{i+1} Plaukta:{j+1} ";
                }
            }
        }
        return "Prece netika atrasta";
        
    }
    static string AprekinatNeaizpilditas(string [,] noliktava){
        int s=0;
        for(int i =0; i<noliktava.GetLength(0);i++){
            for(int j =0; j<noliktava.GetLength(1);j++){
                if(noliktava[i,j]== ""){
                    s = s+1;
                    return $"Tukso plauktu skaits = {s}";
                } 
            }
        }
        return "Nav neviena tuksa plaukta";
    }
}
/*
info no
https://dev.to/aryanabsalan/c-static-class-5771
https://c-sharptutorial.com/array/passing-two-dimensional-array-to-function-in-csharp
*/