Skip to content

Instantly share code, notes, and snippets.

@QRemark
Created January 9, 2024 09:32
Show Gist options
  • Save QRemark/046e706fb499bd94318f489a94575215 to your computer and use it in GitHub Desktop.
Save QRemark/046e706fb499bd94318f489a94575215 to your computer and use it in GitHub Desktop.
Магазин кристаллов
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
namespace homeWork1
{
internal class Program
{
static void Main(string[] args)
{
int gold;
int crystals;
int crystalPrice = 20;
Console.Write($"Добрый день! Спасибо что посетили наш магазин кристалов! " +
$"Сегодня кристалы стоят по {crystalPrice} золота. Скажите " +
$"пожалуйста, сколько у вас золота? Введите число: ");
gold = Convert.ToInt32(Console.ReadLine());
crystals = gold / crystalPrice;
Console.Write($"За Ваше количество золота можно купить {crystals} кристалов. " +
$"Сколько кристалов вы хотите приобрести? Введите число: ");
crystals = Convert.ToInt32(Console.ReadLine());
gold -= crystals*crystalPrice;
Console.WriteLine($"Спасибо за покупку! Вы приобрели {crystals} кристалов. " +
$"У Вас осталось {gold} золота. Приходите еще!");
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment