From f55ffc13bf7f2d92893a048b2986abce1c3e10a4 Mon Sep 17 00:00:00 2001 From: ArhaNge1 Date: Tue, 24 Nov 2026 10:33:21 +0300 Subject: [PATCH] Daily 24.11.26 --- charp/daily/daily24.11-228.cs | 120 ++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 charp/daily/daily24.11-228.cs diff --git a/charp/daily/daily24.11-228.cs b/charp/daily/daily24.11-228.cs new file mode 100644 index 0000000..4da5c6d --- /dev/null +++ b/charp/daily/daily24.11-228.cs @@ -0,0 +1,120 @@ +// http://5.35.127.219:3001/admin/daily-24.11-228/src/branch/main/task.md +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp +{ + class Program + { + static void Main(string[] args) + { + Zadania_1(); + Zadania_2(); + Zadania_3(); + Zadania_4(); + Zadania_5(); + + } + + static void Zadania_1() + { + Console.WriteLine("Задача 1. Переменные покемона"); + string name = Console.ReadLine(); + string type = Console.ReadLine(); + int level = int.Parse(Console.ReadLine() ?? ""); + int hp = int.Parse(Console.ReadLine()); + double attack = double.Parse(Console.ReadLine()); + bool isShiny = false; + + Console.WriteLine($"{name},{type},LVL: {level},HP: {hp},Atk: {attack},shiny: {isShiny}"); + + level = level + 1; + hp = hp - 30; + Console.WriteLine("Изменение данных."); + Console.WriteLine($"{name},{type},LVL: {level},HP: {hp},Atk: {attack},shiny: {isShiny}"); + } + + static void Zadania_2() + { + string[] types = { "fire", "water", "electric", "dragon" }; + + foreach (string attackerType in types) + { + if (attackerType == "fire") + { + Console.WriteLine("Огонь силён против травы"); + } + else if (attackerType == "water") + { + Console.WriteLine("Вода сильна против огня"); + } + else if (attackerType == "grass") + { + Console.WriteLine("Трава сильна против воды"); + } + else if (attackerType == "electric") + { + Console.WriteLine("Электричество сильно против воды"); + } + else + { + Console.WriteLine("Тип не изучен"); + } + } + } + + static void Zadania_3() + { + string name = "water"; + switch (name) + { + case "fire": + Console.WriteLine("Огонь"); + break; + case "water": + Console.WriteLine("Вода"); + break; + case "grass": + Console.WriteLine("Трава"); + break; + default: + Console.WriteLine("Неизвестный тип"); + break; + } + } + + static void Zadania_4() + { + int hp = 100; + int round = 0; + while (hp > 0) + { + round++; + hp -= 17; + } + + Console.WriteLine($"Покемон продержался {round} раундов, HP = {hp}"); + for (int i = 0; i <= 10; i++) + { + if (i % 3 == 0) continue; + if (i == 7) break; + if (i % 2 != 0) + { + Console.Write($"{i}"); + } + } + } + + static void Zadania_5() + { + List Pokemon = new List() { "Pokemon 1", "Pokemon 2", "Charmander", "Pokemon 4" }; + Pokemon.Remove("Pokemon 2"); + Pokemon.Add("Pokemon 5"); + + string otvet = [""]; + } + } +}