diff --git a/Seminars/Seminar03/Self/Task01/Program.cs b/Seminars/Seminar03/Self/Task01/Program.cs new file mode 100644 index 0000000..92ca68e --- /dev/null +++ b/Seminars/Seminar03/Self/Task01/Program.cs @@ -0,0 +1,15 @@ +internal class program +{ + public static void Main() + { + Console.Write("Введите количество углов: "); + int n = Convert.ToInt32(Console.ReadLine()); + + Console.Write("Введите длину стороны: "); + float l = Convert.ToSingle(Console.ReadLine()); + + Console.Write($"Площадь фигуры равна: {(n * Math.Pow(l, 2)) / (4 * Math.Tan(Math.PI / n))}"); + + Console.ReadKey(); + } +} \ No newline at end of file diff --git a/Seminars/Seminar03/Self/Task01/Task01.csproj b/Seminars/Seminar03/Self/Task01/Task01.csproj new file mode 100644 index 0000000..f02677b --- /dev/null +++ b/Seminars/Seminar03/Self/Task01/Task01.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/Seminars/Seminar03/Self/Task02/Program.cs b/Seminars/Seminar03/Self/Task02/Program.cs new file mode 100644 index 0000000..701ba4d --- /dev/null +++ b/Seminars/Seminar03/Self/Task02/Program.cs @@ -0,0 +1,39 @@ +internal class Program +{ + public static void Main() + { + Console.Write("Введите x: "); + float x = Convert.ToSingle(Console.ReadLine()); + + Console.Write("Введите y: "); + float y = Convert.ToSingle(Console.ReadLine()); + + double length = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2)); + + + if (y < 0) + { + Console.WriteLine("Точка не принадлежит области"); + Console.ReadKey(); + return; + } + if (length > 2) + { + Console.WriteLine("Точка не принадлежит области"); + } + else if (length == 2 || length == 1) + { + Console.WriteLine("Точка лежит на границе"); + } + else if (length < 2 && length > 1) + { + Console.WriteLine("Точка лежит внутри области"); + } + else + { + Console.WriteLine("Точка не принадлежит области"); + } + + Console.ReadKey(); + } +} \ No newline at end of file diff --git a/Seminars/Seminar03/Self/Task02/Task02.csproj b/Seminars/Seminar03/Self/Task02/Task02.csproj new file mode 100644 index 0000000..f02677b --- /dev/null +++ b/Seminars/Seminar03/Self/Task02/Task02.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/Seminars/Seminar03/Self/Task03/Program.cs b/Seminars/Seminar03/Self/Task03/Program.cs new file mode 100644 index 0000000..65ba8cb --- /dev/null +++ b/Seminars/Seminar03/Self/Task03/Program.cs @@ -0,0 +1,43 @@ +using System.ComponentModel.Design; + +internal class Program +{ + public static void Main() + { + Console.Write("Введите x: "); + float x = Convert.ToSingle(Console.ReadLine()); + + Console.Write("Введите y: "); + float y = Convert.ToSingle(Console.ReadLine()); + + double length = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2)); + + + if ((y < 0) && length > 1) + { + Console.WriteLine("Точка не принадлежит области"); + } + else if ((y < 0) && length < 1) + { + Console.WriteLine("Точка лежит внутри области"); + } + else if ((y < 0) && length == 1) + { + Console.WriteLine("Точка лежит на границе"); + } + else if (length > 2) + { + Console.WriteLine("Точка не принадлежит области"); + } + else if (length == 2) + { + Console.WriteLine("Точка лежит на границе"); + } + else if (length < 2) + { + Console.WriteLine("Точка лежит внутри области"); + } + + Console.ReadKey(); + } +} \ No newline at end of file diff --git a/Seminars/Seminar03/Self/Task03/Task03.csproj b/Seminars/Seminar03/Self/Task03/Task03.csproj new file mode 100644 index 0000000..f02677b --- /dev/null +++ b/Seminars/Seminar03/Self/Task03/Task03.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/Seminars/Seminar03/Self/Task04/Program.cs b/Seminars/Seminar03/Self/Task04/Program.cs new file mode 100644 index 0000000..e0d0c2b --- /dev/null +++ b/Seminars/Seminar03/Self/Task04/Program.cs @@ -0,0 +1,32 @@ +internal class Program +{ + public static void Main() + { + Console.Write("Введите x: "); + int x = Convert.ToInt32(Console.ReadLine()); + + Console.Write("Введите y: "); + int y = Convert.ToInt32(Console.ReadLine()); + + if (x < y) + { + double F = Math.Sin(x) + Math.Pow(Math.Cos(y), 2); + Console.WriteLine($"x, y, F: {x}, {y}, {F}"); + } + else if (x == y) + { + double F = Math.Log(Math.Abs(x)); + Console.WriteLine($"x, y, F: {x}, {y}, {F}"); + + } + else if (x > y) + { + double F = Math.Sin(Math.Pow(x, 2)) + Math.Cos(y); + Console.WriteLine($"x, y, F: {x}, {y}, {F}"); + + } + + Console.ReadLine(); + + } +} \ No newline at end of file diff --git a/Seminars/Seminar03/Self/Task04/Task04.csproj b/Seminars/Seminar03/Self/Task04/Task04.csproj new file mode 100644 index 0000000..f02677b --- /dev/null +++ b/Seminars/Seminar03/Self/Task04/Task04.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/Seminars/Seminar03/Self/Task05/Program.cs b/Seminars/Seminar03/Self/Task05/Program.cs new file mode 100644 index 0000000..4a4032b --- /dev/null +++ b/Seminars/Seminar03/Self/Task05/Program.cs @@ -0,0 +1,45 @@ +internal class Program +{ + public static void Main() + { + Console.Write("Введите a: "); + double a = Convert.ToSingle(Console.ReadLine()); + + Console.Write("Введите b: "); + double b = Convert.ToSingle(Console.ReadLine()); + + Console.Write("Введите c: "); + double c = Convert.ToSingle(Console.ReadLine()); + + string s_a = a < 0 ? $"{a}" : $"+{a}"; + string s_b = b < 0 ? $"{b}" : $"+{b}"; + string s_c = c < 0 ? $"{c}" : $"+{c}"; + + Console.WriteLine($"{s_a}x^2{s_b}x{s_c}"); + + if (a == 0) + { + Console.WriteLine($"Единственный корень, равный {-c / b}"); + } + else if (b == 0) + { + Console.WriteLine($"Два одинаковых корня, равных +-{Math.Sqrt(-c / a)}"); + } + else if ((Math.Pow(b, 2) - 4 * a * c) < 0) + { + Console.WriteLine("Нет действительных корней"); + } + else if ((Math.Pow(b, 2) - 4 * a * c) == 0) + { + Console.WriteLine($"Один корень, равный: {-b / (2 * a)}"); + } + else if ((Math.Pow(b, 2) - 4 * a * c) > 0) + { + double D = Math.Pow(b, 2) - 4 * a * c; + Console.WriteLine($"Первый корень, равный: {(-b - Math.Sqrt(D))/ (2 * a)}"); + Console.WriteLine($"Второй корень, равный: {(-b - Math.Sqrt(D)) / (2 * a)}"); + } + + Console.ReadKey(); + } +} \ No newline at end of file diff --git a/Seminars/Seminar03/Self/Task05/Task05.csproj b/Seminars/Seminar03/Self/Task05/Task05.csproj new file mode 100644 index 0000000..f02677b --- /dev/null +++ b/Seminars/Seminar03/Self/Task05/Task05.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/Seminars/Seminar04/Self/Task01/Program.cs b/Seminars/Seminar04/Self/Task01/Program.cs new file mode 100644 index 0000000..c52fb60 --- /dev/null +++ b/Seminars/Seminar04/Self/Task01/Program.cs @@ -0,0 +1,22 @@ +internal class Program +{ + public static void Main() + { + string? a = Console.ReadLine(); + char b = a[0]; + int c = Convert.ToInt32(b); + + int F = c switch + { + >= 48 and <= 57 => 100, + >= 65 and <= 90 => 200, + >= 97 and <= 122 => 300, + _ => 400 + }; + + Console.WriteLine(F); + Console.ReadKey(); + + Console.ReadKey(); + } +} \ No newline at end of file diff --git a/Seminars/Seminar04/Self/Task01/Task01.csproj b/Seminars/Seminar04/Self/Task01/Task01.csproj new file mode 100644 index 0000000..f02677b --- /dev/null +++ b/Seminars/Seminar04/Self/Task01/Task01.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/Seminars/Seminar04/Self/Task02/Program.cs b/Seminars/Seminar04/Self/Task02/Program.cs new file mode 100644 index 0000000..b77fbab --- /dev/null +++ b/Seminars/Seminar04/Self/Task02/Program.cs @@ -0,0 +1,34 @@ +internal class Program +{ + public static void Main() + { + string? data = Console.ReadLine(); + + int output = data.ToLower() /* Nintendo */ switch + { + "january" or "январь" => 1, + "february" or "февраль" => 2, + "march" or "март" => 3, + "april" or "апрель" => 4, + "may" or "май" => 5, + "june" or "июнь" => 6, + "july" or "июль" => 7, + "august" or "август" => 8, + "september" or "сентябрь" => 9, + "october" or "октябрь" => 10, + "november" or "ноябрь" => 11, + "december" or "декабрь" => 12, + _ => 0 + }; + + if (output == 0) + { + Console.WriteLine("В году такой месяц отсутствует"); + Console.ReadKey(); + return; + } + + Console.WriteLine(output); + Console.ReadKey(); + } +} \ No newline at end of file diff --git a/Seminars/Seminar04/Self/Task02/Task02.csproj b/Seminars/Seminar04/Self/Task02/Task02.csproj new file mode 100644 index 0000000..f02677b --- /dev/null +++ b/Seminars/Seminar04/Self/Task02/Task02.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/Seminars/Seminar04/Self/Task03/Program.cs b/Seminars/Seminar04/Self/Task03/Program.cs new file mode 100644 index 0000000..6c3970f --- /dev/null +++ b/Seminars/Seminar04/Self/Task03/Program.cs @@ -0,0 +1,48 @@ +internal class Program +{ + public static void Main() + { + Console.Write("Введите код операции: "); + bool code_flag = int.TryParse(Console.ReadLine(), out int code); + + if (code == 0) + { + Console.WriteLine("Некорректно введено значение кода операции"); + Console.ReadKey(); + return; + } + + Console.Write("Введите A: "); + bool a_flag = Single.TryParse(Console.ReadLine(), out float a); + + if (a == 0) + { + Console.WriteLine("Некорректно введено значение A"); + Console.ReadKey(); + return; + } + + Console.Write("Введите B: "); + bool b_flag = Single.TryParse(Console.ReadLine(), out float b); + + if (b == 0) + { + Console.WriteLine("Некорректно введено значение B"); + Console.ReadKey(); + return; + } + + switch (code) + { + case 1: + Console.WriteLine($"{a} + {b} = {a + b}"); break; + case 2: + Console.WriteLine($"{a} - {b} = {a - b}"); break; + case 3: + Console.WriteLine($"{a} * {b} = {a * b}"); break; + case 4: + Console.WriteLine($"{a} / {b} = {a / b}"); break; + } + Console.ReadKey(); + } +} \ No newline at end of file diff --git a/Seminars/Seminar04/Self/Task03/Task03.csproj b/Seminars/Seminar04/Self/Task03/Task03.csproj new file mode 100644 index 0000000..f02677b --- /dev/null +++ b/Seminars/Seminar04/Self/Task03/Task03.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/Seminars/Seminar04/Self/images/Self01.JPG b/Seminars/Seminar04/Self/images/Self01.JPG index 4ac1075..4ffe6f6 100644 Binary files a/Seminars/Seminar04/Self/images/Self01.JPG and b/Seminars/Seminar04/Self/images/Self01.JPG differ