diff --git a/Seminars/Seminar01/Self/Task01/Program.cs b/Seminars/Seminar01/Self/Task01/Program.cs index 3671ed6..1d3616e 100644 --- a/Seminars/Seminar01/Self/Task01/Program.cs +++ b/Seminars/Seminar01/Self/Task01/Program.cs @@ -1 +1,15 @@ // Your code here! +using System; +class Program +{ + static void Main() + { + string firstname = Console.ReadLine(); + string lastname= Console.ReadLine(); + string secondname = Console.ReadLine(); + + Console.WriteLine($"Фамилия: {firstname}"); + Console.WriteLine($"Имя: {lastname}"); + Console.WriteLine($"Отчество: {secondname}"); + } +} \ No newline at end of file diff --git a/Seminars/Seminar01/Self/Task02/Program.cs b/Seminars/Seminar01/Self/Task02/Program.cs index 3671ed6..8700f49 100644 --- a/Seminars/Seminar01/Self/Task02/Program.cs +++ b/Seminars/Seminar01/Self/Task02/Program.cs @@ -1 +1,13 @@ // Your code here! +using System; +class Program +{ + static void Main() + { + string firstname = Console.ReadLine(); + string lastname= Console.ReadLine(); + string secondname = Console.ReadLine(); + + Console.WriteLine($"{firstname} {lastname} {secondname}"); + } +} \ No newline at end of file diff --git a/Seminars/Seminar01/Self/Task03/Program.cs b/Seminars/Seminar01/Self/Task03/Program.cs index 3671ed6..49dc3d4 100644 --- a/Seminars/Seminar01/Self/Task03/Program.cs +++ b/Seminars/Seminar01/Self/Task03/Program.cs @@ -1 +1,11 @@ // Your code here! +using System; +class Program +{ + static void Main() + { + string firstname = Console.ReadLine(); + + Console.WriteLine($"Привет, {firstname}!"); + } +} \ No newline at end of file diff --git a/Seminars/Seminar01/Self/Task04/Program.cs b/Seminars/Seminar01/Self/Task04/Program.cs index 3671ed6..f86a957 100644 --- a/Seminars/Seminar01/Self/Task04/Program.cs +++ b/Seminars/Seminar01/Self/Task04/Program.cs @@ -1 +1,11 @@ // Your code here! +using System; +class Program +{ + static void Main() + { + Console.BackgroundColor = ConsoleColor.Green; + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("floppABOBA"); + } +} \ No newline at end of file diff --git a/Seminars/Seminar01/Self/Task05/Program.cs b/Seminars/Seminar01/Self/Task05/Program.cs index 3671ed6..68a1be6 100644 --- a/Seminars/Seminar01/Self/Task05/Program.cs +++ b/Seminars/Seminar01/Self/Task05/Program.cs @@ -1 +1,14 @@ // Your code here! +using System; +class Program +{ + static void Main() + { + float u = Convert.ToInt32(Console.ReadLine()); + float r = Convert.ToInt32(Console.ReadLine()); + float i = u / r; + float p = (u * u) / r; + Console.WriteLine("I = {0}", i); + Console.WriteLine("P = {0}", p); + } +} \ No newline at end of file diff --git a/Seminars/Seminar01/Self/Task06/Program.cs b/Seminars/Seminar01/Self/Task06/Program.cs index 83fa4f4..5cfacdc 100644 --- a/Seminars/Seminar01/Self/Task06/Program.cs +++ b/Seminars/Seminar01/Self/Task06/Program.cs @@ -1,2 +1,11 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +using System; +class Program +{ + static void Main() + { + double a = Convert.ToDouble(Console.ReadLine()); + double b = Convert.ToDouble(Console.ReadLine()); + + Console.WriteLine(Math.Sqrt((a * a) + (b * b))); + } +} \ No newline at end of file diff --git a/Seminars/Seminar03/Self/Task01/Program.cs b/Seminars/Seminar03/Self/Task01/Program.cs new file mode 100644 index 0000000..a475c67 --- /dev/null +++ b/Seminars/Seminar03/Self/Task01/Program.cs @@ -0,0 +1,15 @@ +using System; +class Program +{ + public static void Main() + { + int n = Convert.ToInt32(Console.ReadLine()); + double.TryParse(Console.ReadLine(), out double l); + + if (1 <= n && n < 11 && n != 2 && l > 0 && Math.Tan(Math.PI / n) > 0) + { + double s = ((n * l) * (n * l)) / (4 * Math.Tan(Math.PI / n)); + Console.WriteLine(s); + } + } +} \ No newline at end of file diff --git a/Seminars/Seminar03/Self/Task02/Program.cs b/Seminars/Seminar03/Self/Task02/Program.cs new file mode 100644 index 0000000..eb21179 --- /dev/null +++ b/Seminars/Seminar03/Self/Task02/Program.cs @@ -0,0 +1,35 @@ +using System; +class Aboba +{ + public static void Main() + { + double.TryParse(Console.ReadLine(), out double x); + double.TryParse(Console.ReadLine(), out double y); + string a = "Точка внутри области"; + string b = "Точка на границе области"; + string c = "Точка не принадлежит области"; + + if (y < 0) + { + Console.WriteLine(c); + } + else + { + if ((x * x + y * y) > 1 && (x * x + y * y) < 4) + { + Console.WriteLine(a); + } + else + { + if ((x * x + y * y) == 1 || (x * x + y * y) == 4) + { + Console.WriteLine(b); + } + else + { + Console.WriteLine(c); + } + } + } + } +} \ No newline at end of file diff --git a/Seminars/Seminar03/Self/Task03/Program.cs b/Seminars/Seminar03/Self/Task03/Program.cs new file mode 100644 index 0000000..bef10a8 --- /dev/null +++ b/Seminars/Seminar03/Self/Task03/Program.cs @@ -0,0 +1,51 @@ +using System; +class Program +{ + public static void Main() + { + double.TryParse(Console.ReadLine(), out double x); + double.TryParse(Console.ReadLine(), out double y); + + string a = "Точка внутри области"; + string b = "Точка на границе области"; + string c = "Точка не принадлежит области"; + + if (y < 0) + { + if (x * x + y * y < 1) + { + Console.WriteLine(a); + } + else + { + if (x * x + y * y == 1) + { + Console.WriteLine(b); + } + else + { + Console.WriteLine(c); + } + + } + } + else + { + if (x * x + y * y < 4) + { + Console.WriteLine(a); + } + else + { + if (x * x + y * y == 4) + { + Console.WriteLine(b); + } + else + { + Console.WriteLine(c); + } + } + } + } +} diff --git a/Seminars/Seminar03/Self/Task04/Program.cs b/Seminars/Seminar03/Self/Task04/Program.cs new file mode 100644 index 0000000..7097f2d --- /dev/null +++ b/Seminars/Seminar03/Self/Task04/Program.cs @@ -0,0 +1,30 @@ +using System; +class Program +{ + public static void Main() + { + double.TryParse(Console.ReadLine(), out double x); + double.TryParse(Console.ReadLine(), out double y); + Console.WriteLine(x); + Console.WriteLine(y); + + if (x < y) + { + double f1 = Math.Sin(x) + (Math.Cos(y) * Math.Cos(y)); + Console.WriteLine(f1); + } + else + { + if (x == y) + { + double f2 = Math.Log(x); + Console.WriteLine(f2); + } + else + { + double f3 = Math.Sin(x * x) + (Math.Cos(y)); + Console.WriteLine(f3); + } + } + } +} \ No newline at end of file diff --git a/Seminars/Seminar03/Self/Task05/Program.cs b/Seminars/Seminar03/Self/Task05/Program.cs new file mode 100644 index 0000000..39fd751 --- /dev/null +++ b/Seminars/Seminar03/Self/Task05/Program.cs @@ -0,0 +1,51 @@ +using System.Data; +using System; +class Program +{ + public static void Main() + { + double.TryParse(Console.ReadLine(), out double a); + double.TryParse(Console.ReadLine(), out double b); + double.TryParse(Console.ReadLine(), out double c); + + Console.WriteLine($"{a}x^2 + {b}x + {c}"); + + if (a == 0) + { + double x1 = -c / b; + Console.WriteLine($"x = {x1}"); + } + else + { + if (b == 0) + { + double x2 = Math.Sqrt(-c / a); + Console.WriteLine($"x1 = {x2}"); + Console.WriteLine($"x2 = -{x2}"); + } + else + { + double d = b * b - 4 * a * c; + if (d < 0) + { + Console.WriteLine("Нет действительных корней"); + } + else + { + if (d == 0) + { + double x3 = -b / (2 * a); + Console.WriteLine($"x = {x3}"); + } + else + { + double x4 = (-b + Math.Sqrt(d)) / (2 * a); + double x5 = (-b - Math.Sqrt(d)) / (2 * a); + Console.WriteLine($"x1 = {x4}"); + Console.WriteLine($"x2 = {x5}"); + } + } + } + } + } +} \ No newline at end of file diff --git a/Seminars/Seminar04/Self/Task01/Program1.cs b/Seminars/Seminar04/Self/Task01/Program1.cs new file mode 100644 index 0000000..8abf6b1 --- /dev/null +++ b/Seminars/Seminar04/Self/Task01/Program1.cs @@ -0,0 +1,25 @@ +using System; +class Program1 +{ + static void Main() + { + string str = Console.ReadLine(); + char a = str[0]; + switch (a) + { + case >='0' and <='9': + Console.WriteLine($"{a} 100"); + break; + case >='A' and <='Z': + Console.WriteLine($"{a} 200"); + break; + case >='a' and <='z': + Console.WriteLine($"{a} 300"); + break; + + default: + Console.WriteLine($"{a} 400"); + break; + } + } +} \ No newline at end of file diff --git a/Seminars/Seminar04/Self/Task02/Program.cs b/Seminars/Seminar04/Self/Task02/Program.cs new file mode 100644 index 0000000..c99f3cd --- /dev/null +++ b/Seminars/Seminar04/Self/Task02/Program.cs @@ -0,0 +1,52 @@ +using System; +class Program +{ + static void Main(string[] args) + { + string str = Console.ReadLine(); + + switch (str) + { + case "January" or "Январь" or "january" or "январь": + Console.WriteLine("1"); + break; + case "February" or "Февраль" or "february" or "февраль": + Console.WriteLine("2"); + break; + case "March" or "Март" or "march" or "март": + Console.WriteLine("3"); + break; + case "April" or "Апрель" or "april" or "апрель": + Console.WriteLine("4"); + break; + case "May" or "Май" or "may" or "май": + Console.WriteLine("5"); + break; + case "June" or "Июнь" or "june" or "июнь": + Console.WriteLine("6"); + break; + case "July" or "Июль" or "july" or "июль": + Console.WriteLine("7"); + break; + case "August" or "Август" or "august" or "август": + Console.WriteLine("8"); + break; + case "September" or "Сентябрь" or "september" or "сентябрь": + Console.WriteLine("9"); + break; + case "October" or "Октябрь" or "october" or "октябрь": + Console.WriteLine("10"); + break; + case "November" or "Ноябрь" or "november" or "ноябрь": + Console.WriteLine("11"); + break; + case "December" or "Декабрь" or "december" or "декабрь": + Console.WriteLine("12"); + break; + + default: + Console.WriteLine("В году такой месяц отстутствует."); + break; + } + } +} \ No newline at end of file diff --git a/Seminars/Seminar04/Self/Task03/Program.cs b/Seminars/Seminar04/Self/Task03/Program.cs new file mode 100644 index 0000000..967d2b3 --- /dev/null +++ b/Seminars/Seminar04/Self/Task03/Program.cs @@ -0,0 +1,40 @@ +using System; +class Program +{ + public static void Main() + { + Console.Write("Введите код операции: "); + int x = Convert.ToInt32(Console.ReadLine()); + Console.Write("Введите A: "); + double a = Convert.ToDouble(Console.ReadLine()); + Console.Write("Введите B: "); + double b = Convert.ToDouble(Console.ReadLine()); + + if (b != 0 && x <= 4 && x >= 1) + { + switch (x) + { + case 1: + double s = a + b; + Console.WriteLine($"{a} + {b} = {s}"); + break; + + case 2: + double q = a - b; + Console.WriteLine($"{a} - {b} = {q}"); + break; + + case 3: + double p = a * b; + Console.WriteLine($"{a} * {b} = {p}"); + break; + + case 4: + double l = a / b; + Console.WriteLine($"{a} / {b} = {l}"); + break; + } + } + else {Console.WriteLine("Error!");} + } +} diff --git a/Seminars/Seminar04/Self/Task04/Program.cs b/Seminars/Seminar04/Self/Task04/Program.cs new file mode 100644 index 0000000..0eddd50 --- /dev/null +++ b/Seminars/Seminar04/Self/Task04/Program.cs @@ -0,0 +1,55 @@ +using System.Runtime.Serialization; +using System.Runtime.Intrinsics.X86; +using Microsoft.VisualBasic; +using System; +class Program +{ + static void Main(string[] args) + { + Console.Write("Ввод: "); + string str = Console.ReadLine(); + string[] strings = str.Split(' '); + if (strings.Length != 3) + { + Console.WriteLine("Переполнение"); + } + else + { + string a = strings[0]; + string b = strings[2]; + char op = Convert.ToChar(strings[1]); + + switch(op) + { + case '+': + double.TryParse(a, out double aa); + double.TryParse(b, out double bb); + Console.Write("Вывод: "); + Console.WriteLine(aa + bb); + break; + case '-': + double.TryParse(a, out double aaa); + double.TryParse(b, out double bbb); + Console.Write("Вывод: "); + Console.WriteLine(aaa - bbb); + break; + case '*': + double.TryParse(a, out double a1); + double.TryParse(b, out double b1); + Console.Write("Вывод: "); + Console.WriteLine(a1 * b1); + break; + case '/': + double.TryParse(a, out double a2); + double.TryParse(b, out double b2); + Console.Write("Вывод: "); + Console.WriteLine(a2 / b2); + break; + + default: + Console.WriteLine("Недопустимая операция"); + break; + } + } + } +} \ No newline at end of file diff --git a/Seminars/Seminar05/Self/Self01/Program.cs b/Seminars/Seminar05/Self/Self01/Program.cs index db1541a..8543836 100644 --- a/Seminars/Seminar05/Self/Self01/Program.cs +++ b/Seminars/Seminar05/Self/Self01/Program.cs @@ -1 +1,29 @@ // Ваше решение. +using System; +class Aboba +{ + public static void Main() + { + string a = "Число кратно 2 и 3"; + string b = "Число не соответствует условию"; + int number = 0; + do + { + if (number == 20) + { + number++; + } + else if (number % 2 == 0 && number % 3 == 0) + { + Console.WriteLine($"{number} - {a}"); + number++; + } + else + { + Console.WriteLine($"{number} - {b}"); + number++; + } + + } while(number <= 50); + } +} \ No newline at end of file diff --git a/Seminars/Seminar05/Self/Self02/Program.cs b/Seminars/Seminar05/Self/Self02/Program.cs index db1541a..238f104 100644 --- a/Seminars/Seminar05/Self/Self02/Program.cs +++ b/Seminars/Seminar05/Self/Self02/Program.cs @@ -1 +1,34 @@ -// Ваше решение. +using System; +// Ваше решение. +class Program +{ + static void Main(string[] args) + { + int count_int = 0; + int count_double = 0; + int count_oth = 0; + + string s = Console.ReadLine(); + do + { + int.TryParse(s, out int a); + double.TryParse(s, out double b); + if (a != 0 || s == "0") + { + count_int += 1; + } + else if (b != 0) + { + count_double += 1; + } + else + { + count_oth += 1; + } + s = Console.ReadLine(); + } while (s != "0"); + Console.WriteLine($"Количество int: {count_int}"); + Console.WriteLine($"Количество double: {count_double}"); + Console.WriteLine($"Количество нечисловых: {count_oth}"); + } +} \ No newline at end of file diff --git a/Seminars/Seminar05/Self/Self03/Program.cs b/Seminars/Seminar05/Self/Self03/Program.cs index db1541a..7137e39 100644 --- a/Seminars/Seminar05/Self/Self03/Program.cs +++ b/Seminars/Seminar05/Self/Self03/Program.cs @@ -1 +1,25 @@ // Ваше решение. +using System; +class Program +{ + public static void Main() + { + double.TryParse(Console.ReadLine(), out double a); + int.TryParse(Console.ReadLine(), out int n); + double summa_pr = 0; + double x = 0; + double x1 = 0; + double y1 = 0; + double plus = a / n; + + while (x < a) + { + x1 += plus; + y1 = x1 * x1; + summa_pr += (x1 - x) * y1; + x += plus; + } + + Console.WriteLine($"Площадь: {summa_pr}"); + } +} \ No newline at end of file diff --git a/Seminars/Seminar05/Self/Self04/Program.cs b/Seminars/Seminar05/Self/Self04/Program.cs index db1541a..884a184 100644 --- a/Seminars/Seminar05/Self/Self04/Program.cs +++ b/Seminars/Seminar05/Self/Self04/Program.cs @@ -1 +1,22 @@ // Ваше решение. +using System; +class Program +{ + public static void Main() + { + double a = 1; + double b = 2; + double c = 3; + double summa = 0; + double current = 1 / (a * b * c); + while (current > double.Epsilon) + { + summa += current; + a += 1; + b += 1; + c += 1; + current = 1 / (a * b * c); + } + Console.WriteLine(summa); + } +} \ No newline at end of file diff --git a/Seminars/Seminar05/Self/Self05/Program.cs b/Seminars/Seminar05/Self/Self05/Program.cs index db1541a..1ada9e5 100644 --- a/Seminars/Seminar05/Self/Self05/Program.cs +++ b/Seminars/Seminar05/Self/Self05/Program.cs @@ -1 +1,19 @@ // Ваше решение. +using System; +class Program +{ + public static void Main() + { + int.TryParse(Console.ReadLine(), out int k); + int k1 = 1; + double summa = 0; + while (k1 <= k) + { + summa += 1.0 / k1; + k1 += 1; + } + string s = string.Format("{0:F4}", summa); + Console.WriteLine(s); + + } +} \ No newline at end of file diff --git a/Seminars/Seminar05/Self/Self06/Program.cs b/Seminars/Seminar05/Self/Self06/Program.cs index db1541a..f0ef430 100644 --- a/Seminars/Seminar05/Self/Self06/Program.cs +++ b/Seminars/Seminar05/Self/Self06/Program.cs @@ -1 +1,14 @@ // Ваше решение. +using System; +class Program +{ + public static void Main() + { + int n = 111; + while (n <= 999) + { + Console.WriteLine(n); + n += 111; + } + } +} \ No newline at end of file diff --git a/Seminars/Seminar05/Self/Self07/Program.cs b/Seminars/Seminar05/Self/Self07/Program.cs index db1541a..73efb9a 100644 --- a/Seminars/Seminar05/Self/Self07/Program.cs +++ b/Seminars/Seminar05/Self/Self07/Program.cs @@ -1 +1,28 @@ // Ваше решение. +using System; +class Program +{ + public static void Main() + { + int.TryParse(Console.ReadLine(), out int n); + string str_n = Convert.ToString(n); + int i = str_n.Length - 1; + bool f = false; + string new_s = ""; + while (i >= 0) + { + if (str_n[i] == '0' && f == false) + { + i -= 1; + continue; + } + else + { + f = true; + new_s += str_n[i]; + } + i -= 1; + } + Console.WriteLine($"{n} -> {new_s}"); + } +} \ No newline at end of file diff --git a/Seminars/Seminar05/Self/Self08/Program.cs b/Seminars/Seminar05/Self/Self08/Program.cs index db1541a..e6953ff 100644 --- a/Seminars/Seminar05/Self/Self08/Program.cs +++ b/Seminars/Seminar05/Self/Self08/Program.cs @@ -1 +1,37 @@ // Ваше решение. +using System; +class Program +{ + public static void Main() + { + int.TryParse(Console.ReadLine(), out int n); + int.TryParse(Console.ReadLine(), out int k); + string str_n = Convert.ToString(n); + string answer = ""; + if (k == 0 || k > str_n.Length) + { + while (k == 0 || k > str_n.Length) + { + Console.WriteLine("Некорректный ввод K!"); + k = int.Parse(Console.ReadLine()); + } + int i = 0; + while (i < k) + { + answer += str_n[i]; + i += 1; + } + Console.WriteLine(answer); + } + else + { + int i = 0; + while (i < k) + { + answer += str_n[i]; + i += 1; + } + Console.WriteLine(answer); + } + } +} \ No newline at end of file diff --git a/Seminars/Seminar05/Self/Self09/Program.cs b/Seminars/Seminar05/Self/Self09/Program.cs index db1541a..2dee94a 100644 --- a/Seminars/Seminar05/Self/Self09/Program.cs +++ b/Seminars/Seminar05/Self/Self09/Program.cs @@ -1 +1,19 @@ // Ваше решение. +using System; +class Program +{ + public static void Main() + { + double.TryParse(Console.ReadLine(), out double x); + double.TryParse(Console.ReadLine(), out double y); + + if (((x * x + y * y <= 4) && (y <= 0.5 * x) && (y >= 0)) || ((x * x + y * y <= 4) && (y <= 0) && (x >= 0))) + { + Console.WriteLine("true"); + } + else + { + Console.WriteLine("false"); + } + } +} \ No newline at end of file diff --git a/Seminars/Seminar06/Self/Self01/Program.cs b/Seminars/Seminar06/Self/Self01/Program.cs index db1541a..afee6a7 100644 --- a/Seminars/Seminar06/Self/Self01/Program.cs +++ b/Seminars/Seminar06/Self/Self01/Program.cs @@ -1 +1,19 @@ -// Ваше решение. +using System; +class Program +{ + public static void Main() + { + bool p = false; + bool q = false; + do + { + do + { + bool F = !(p & q) & !(p | !q); + Console.WriteLine($"p = {p} q = {q} F = {F}"); + q = !q; + } while (q); + p = !p; + } while (p); + } +} diff --git a/Seminars/Seminar06/Self/Self02/Program.cs b/Seminars/Seminar06/Self/Self02/Program.cs index db1541a..a98b8ea 100644 --- a/Seminars/Seminar06/Self/Self02/Program.cs +++ b/Seminars/Seminar06/Self/Self02/Program.cs @@ -1 +1,25 @@ -// Ваше решение. +using System; +class Program +{ + public static void Main() + { + bool a = false; + bool b = false; + bool c = false; + Console.WriteLine("a\tb\tc\tF"); + do + { + do + { + do + { + bool F = !(a || b && c) || a; + Console.WriteLine($"{a}\t{b}\t{c}\t{F}"); + c = !c; + } while (c); + b = !b; + } while (b); + a = !a; + } while (a); + } +} \ No newline at end of file diff --git a/Seminars/Seminar06/Self/Self03/Program.cs b/Seminars/Seminar06/Self/Self03/Program.cs index db1541a..a2cff72 100644 --- a/Seminars/Seminar06/Self/Self03/Program.cs +++ b/Seminars/Seminar06/Self/Self03/Program.cs @@ -1 +1,42 @@ -// Ваше решение. +using System; +class Program +{ + public static void Main() + { + int n1 = 2000; + int n2 = 3000; + string n_str; + + while (n1 <= n2) + { + n_str = Convert.ToString(n1); + int count = 1; + bool f = true; + for (int i = 0; i < n_str.Length; i++) + { + for (int j = 0; j < n_str.Length; j++) + { + if (i != j) + { + if (n_str[i] == n_str[j]) + { + count += 1; + } + } + } + if (count == 2) + { + f = false; + break; + } + count = 1; + } + if (f) + { + Console.WriteLine(n1); + } + + n1 += 1; + } + } +} \ No newline at end of file