Created
January 9, 2024 09:32
-
-
Save QRemark/046e706fb499bd94318f489a94575215 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.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