/*
Veidoja: Toms Trencis
Grupa: 110 
Praktiskais darbs 7
Izmantotais Compiler: https://www.onlinegdb.com/online_csharp_compiler
*/

/*
// 1. uzdevums 
/*
using System;
using System.Collections.Generic;

class HelloWorld
{
static void Main()
{
List<double> izdevumi = IevadietIzdevumus();
}

static List<double> IevadietIzdevumus()
{
List<double> saraksts = new List<double>();
while (true)
{
Console.WriteLine("Ievadiet izdevumu summu:");
string ievade = Console.ReadLine();
if (ievade == "")
break;
if (double.TryParse(ievade, out double summa))
saraksts.Add(summa);
else
Console.WriteLine("KLUDA! ");
}
return saraksts;
}

static List<double> FiltretIzdevumus(List<double> izdevumi, double minimums)
{
List<double> filtretieIzdevumi = new List<double>();
foreach (double x in izdevumi)
{
if (x >= minimums)
filtretieIzdevumi.Add(x);
}
return filtretieIzdevumi;
}

static double AprekinatMainigo(List<double> dati)
{
if (dati == null || dati.Count == 0)
return 0;

double min = double.MaxValue;
double max = double.MinValue;

foreach (double x in dati)
{
if (x < min) min = x;
if (x > max) max = x;
}

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

/*
// 2. uzdevums

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class HelloWorld {
static void Main() {
string[,] Noliktava = {
{"1A", "2A", "3A", "4A", "5A"},
{"1B", "2B", "3B", "4B", "5B"},
{"1C", "2C", "3C", "4C", "5C"}
};

Console.WriteLine("Ievadiet preces codu (1A-5A), (1B-5B), (1C-5C)");
string Noliktava101 = Console.ReadLine();
AtklatPreci(Noliktava, Noliktava101);
}

static string AtklatPreci(string[,] Noliktava, string kods)
{
int paths = Noliktava.GetLength(0);
int shelfs = Noliktava.GetLength(1);
bool atrasts = false;
int atrEja = -1, atrPlauks = -1;

for (int eja = 0; eja < paths; eja++)
{
for (int plaukts = 0; plaukts < shelfs; plaukts++)
{
if (Noliktava[eja, plaukts] == kods)
{
atrasts = true;
atrEja = eja + 1;
atrPlauks = plaukts + 1;
break;
}
}
if (atrasts)
break;
}

if (atrasts)
{
Console.WriteLine($"Prece atrasta: Eja {atrEja}, Plaukts {atrPlauks}");
}
else
{
Console.WriteLine("ERROR 404 PRECE NAV ATRASTA!");
}

return null;
}


static int AprekinatNeaizpilditas(string[,] Noliktava)
{
    int empty = 0;

    int paths = Noliktava.GetLength(0);
    int shelfs = Noliktava.GetLength(1);

    for (int eja = 0; eja < paths; eja++)
    {
        for (int plaukts = 0; plaukts < shelfs; plaukts++)
        {
            if (Noliktava[eja, plaukts] == null || Noliktava[eja, plaukts] == "")
            {
                empty++;
            }
        }
    }

    return empty;
}
}

*/


/*

// 3. uzdevums.


using System;
class Program
{
    static void Main()
    {
        Console.WriteLine("Ievadiet x1: ");
        double x1 = double.Parse(Console.ReadLine());
        
        Console.WriteLine("Ievadiet y1: ");
        double y1 = double.Parse(Console.ReadLine());
        
        Console.WriteLine("Ievadiet x2: ");
        double x2 = double.Parse(Console.ReadLine());
        
        Console.WriteLine("Ievadiet y2: ");
        double y2 = double.Parse(Console.ReadLine());
        
        double attalums = AprekinatPlaknesAttalumu(x1, y1, x2, y2);
        Console.WriteLine("Attalums: " + attalums);
        
        Console.WriteLine("Ievadiet gradus: ");
        double gradi = double.Parse(Console.ReadLine());
        
        double rad = KonvertetRadianos(gradi);
        Console.WriteLine("Radiani: " + rad);
    }

    static double AprekinatPlaknesAttalumu(double x1, double y1, double x2, double y2)
    {
        double dx = x2 - x1;
        double dy = y2 - y1;
        double sum = Math.Pow(dx, 2) + Math.Pow(dy, 2);
        return Math.Sqrt(sum);
    }

    static double KonvertetRadianos(double gradi)
    {
        return gradi * (Math.PI / 180);
    }
}

*/