Last active
January 21, 2023 11:59
-
-
Save GigaOrts/380eae8e09e306732336e6fbb12a8401 to your computer and use it in GitHub Desktop.
Домашка 7 Основы программирования
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace ЯЮниор_Домашка | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int crystalToMoney = 15; | |
Console.WriteLine("Введите желаемое количество монет: "); | |
int playerMoney = Convert.ToInt32(Console.ReadLine()); | |
int extraNeededMoney; | |
Console.WriteLine($"\nОтлично! У Вас {playerMoney} монет."); | |
Console.WriteLine($"Сколько кристаллов хотите купить?"); | |
Console.WriteLine($"Курс - {crystalToMoney} монет/1 кристалл"); | |
int numberOfCrystalsToBuy = Convert.ToInt32(Console.ReadLine()); | |
playerMoney -= numberOfCrystalsToBuy * crystalToMoney; | |
if (playerMoney >= 0) | |
{ | |
Console.WriteLine($"\nУ вас:\t{playerMoney} монет"); | |
Console.WriteLine($"\t{numberOfCrystalsToBuy} кристаллов"); | |
} | |
else | |
{ | |
extraNeededMoney = -playerMoney; | |
Console.WriteLine("Не хватает " + extraNeededMoney + " монет!"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment