Edgars Ševcuks 110grupan 7praktiskais darbs 1,2,3 uzdevumi
onlinegdb
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class program
{
    static List<double> summa = new List<double>();
    static List<double> izejasdati = new List<double>();
    static List<double> dati = new List<double>();
    static void Main()
    {
        bool turpini = true;

        do
        {
            Console.Clear();
            Console.WriteLine("ievadiet skaitli");

            string izd = Console.ReadLine();

            double reikini;
            if (Double.TryParse(izd, out reikini))
            {
                summa.Add(reikini);
            }
            else
            {
                string beigas = izd;


                if (beigas == "")
                {
                    turpini = false;
                }
            }
        }


        while (turpini == true);

        foreach (double i in summa)
        {
            Console.WriteLine(i);
        }
        
        Console.WriteLine();
        FiltretIzdevumus(summa, izejasdati);
        foreach (double x in izejasdati)
        {
            Console.WriteLine(x);
        }
        
        Console.WriteLine("diapazons "+ AprekinatMainibu(izejasdati, dati));
        
       foreach (double z in dati)
        {
           Console.WriteLine(z);
        }
        
    }
    static List<double> FiltretIzdevumus(List<double> summa,  List<double> izejasdati)
    {
        foreach (double i in summa) 
        {
            if (i < 10)
            {
                continue;
            }
            izejasdati.Add(i);
        }
        return izejasdati;
    }
    static double AprekinatMainibu(List<double> dati, List<double> izejasdati)
    {
        foreach (double i in izejasdati) 
        {
            dati.Add(i);
        }
        
        
        double min = dati.Min();
        double max = dati.Max();

        double diapazons = Math.Abs(max - min);
        return diapazons;
    }
}

using System;
class HelloWorld 
{
  static void Main(string[] args) 
   {
    
        string[,] noliktava =
        {
            {"a1", "a2", "a3", "a4"},
            {"b1", "b2", "b3", "b4"},
            
        };
        string kods;
      
        AtklatPreci(noliktava, out kods);
        AprekinatNeaizpilditas(noliktava);
    }
        public static string AtklatPreci(string[,] noliktava, out string kods)
    {
        for (int i = 0; i < noliktava.GetLength(0); i++)
        {
            for (int j = 0; j < noliktava.GetLength(1); j++)
            {
            }
        }
        bool cikls = true;
        do
        {
            Console.WriteLine("Ievadiet precu kodu tas ir no a1 lidz b4");
            kods = Console.ReadLine();
            for (int i = 0; i < noliktava.GetLength(0); i++)
            {
                for (int j = 0; j < noliktava.GetLength(1); j++)
                {
                    if (noliktava[i, j] == kods)
                    {
                        Console.WriteLine($"Precu kods {kods} atrasts Eja {i} un Plaukta {j} ");
                        cikls = false;
                    }
                }
            }
            if(cikls== true)
            {
                Console.WriteLine("Prece nav atrasta!");
            }
            
        }
        while (cikls);
        return kods;
    }
    
    public static int AprekinatNeaizpilditas(string[,] noliktava)
    {
        int skaits = 0;

        for (int i = 0; i < noliktava.GetLength(0); i++)
        {
            for (int j = 0; j < noliktava.GetLength(1); j++)
            {
                if (string.IsNullOrEmpty(noliktava[i, j]))
                {   
                    skaits++;
                }
            }
        }

        return skaits;
    }
}


using System;
class Program
{
  static void Main() 
  {
      
     Console.WriteLine("Plaknes attālums ir: " + ApreikinatPlaknesAttalumu());
     KonvertetRadianos();
  }
  static double ApreikinatPlaknesAttalumu()
  {
      Console.WriteLine("ievadi x1: ");
      int x1 = Convert.ToInt32(Console.ReadLine());
      Console.WriteLine("ievadi y1: ");
      int y1 = Convert.ToInt32(Console.ReadLine());
      Console.WriteLine("ievadi x2: ");
      int x2 = Convert.ToInt32(Console.ReadLine());
      Console.WriteLine("ievadi y2: ");
      int y2 = Convert.ToInt32(Console.ReadLine());
      
      double d = Math.Sqrt(Math.Pow((x2 - x1), 2) + Math.Pow((y2 - y1), 2));
      return d;
  }
  static double KonvertetRadianos()
  {
      Console.WriteLine("ievadiet mainīgo grādi");
      double gradi = Convert.ToDouble(Console.ReadLine());
      double radiani =(gradi * (Math.PI/180));
      Console.WriteLine(radiani);
      return radiani;
  }
}