generated from admin/template
49 lines
1.6 KiB
Markdown
49 lines
1.6 KiB
Markdown
# Лабораторная работа №2
|
|
|
|
* **Студент:** [Тимонина Э.С.]
|
|
* **Вариант / Карточка:** [Например: #025 Pikachu]
|
|
|
|
---
|
|
|
|
## Ключевой код
|
|
```csharp
|
|
|
|
|
|
//ЗАДАНИЕ 1
|
|
using System;
|
|
|
|
public class lab2
|
|
{
|
|
public static void Main()
|
|
{
|
|
int pokemonBaseAttack, pokemonLevel;
|
|
Console.WriteLine("=== Прокачка покемона ===");
|
|
Console.Write("Введите значение базовой атаки: ");
|
|
pokemonBaseAttack = int.Parse(Console.ReadLine());
|
|
Console.Write("Введите количество полученных уровней: ");
|
|
pokemonLevel = int.Parse(Console.ReadLine());
|
|
Console.WriteLine($"Итоговая атака покемона = {pokemonBaseAttack + (pokemonLevel * 5)} (Базовая атака + (Уровни × 5))");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//ЗАДАНИЕ 2
|
|
using System;
|
|
|
|
public class lab2
|
|
{
|
|
public static void Main()
|
|
{
|
|
int trainerBalance = 1500;
|
|
int potionPrice = 200;
|
|
int potionBuyAmount;
|
|
Console.WriteLine($"Текущий баланс средств Тренера: {trainerBalance}");
|
|
Console.WriteLine($">> стоимость зелья лечени = {potionPrice} монет <<");
|
|
Console.Write("Введите количество покупаемых зелий: ");
|
|
potionBuyAmount = int.Parse(Console.ReadLine());
|
|
Console.WriteLine($"Успешная покупка на сумму {potionPrice * potionBuyAmount} монет. Ваш остаток {trainerBalance - (potionPrice * potionBuyAmount)}.");
|
|
Console.ReadKey();
|
|
}
|
|
}
|