Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Ana19997/6b1b9939d19b6bf2a82124360dd13c5c to your computer and use it in GitHub Desktop.
Save Ana19997/6b1b9939d19b6bf2a82124360dd13c5c to your computer and use it in GitHub Desktop.
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