Skip to content

Instantly share code, notes, and snippets.

@Ana19997
Created April 30, 2021 12:06
Show Gist options
  • Save Ana19997/45c34d6f5ffa41de14dcf6be8427e8cf to your computer and use it in GitHub Desktop.
Save Ana19997/45c34d6f5ffa41de14dcf6be8427e8cf 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 golgToCrystals = 5;
float gold;
float crystals;
string userInput = "";
float Count;
Console.WriteLine("Приветствуем Вас в магазине. Вы можете купить у нас кристаллы.");
Console.WriteLine("Сколько кристаллов Вам требуется:");
crystals = Convert.ToSingle(Console.ReadLine());
Console.WriteLine("Введите количество золота:");
gold = Convert.ToSingle(Console.ReadLine());
switch (userInput)
{
case "":
Count = Convert.ToSingle(Console.ReadLine());
if (gold >= Count)
{
gold -= Count;
crystals += Count / golgToCrystals;
}
else
{
Console.WriteLine("Недопустимое количество");
}
break;
}
Console.WriteLine("У вас " + gold + "и" + crystals);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment