Created
May 8, 2021 05:09
-
-
Save Ana19997/6b1b9939d19b6bf2a82124360dd13c5c to your computer and use it in GitHub Desktop.
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace магазин | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int goldToCrystals = 5; | |
float crystals; | |
float cost; | |
float wallet; | |
Console.WriteLine("Приветствуем Вас в магазине. Вы можете обменять у нас золото на кристаллы."); | |
Console.WriteLine("Сколько Вам требуется кристаллов:"); | |
crystals = Convert.ToSingle(Console.ReadLine()); | |
Console.Write("Введите баланс кошелька:"); | |
wallet = Convert.ToSingle(Console.ReadLine()); | |
if (wallet >= goldToCrystals) | |
{ | |
cost = crystals * goldToCrystals; | |
wallet -= cost; | |
crystals = cost / goldToCrystals; | |
} | |
else | |
{ | |
Console.WriteLine("Недопустимое количесвтво золота"); | |
} | |
Console.WriteLine("Ваш баланс: " + wallet + " золота и " + crystals + " кристаллов."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment