Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp3
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int priceOfCrystal = 10;
- int countOfCrystal;
- int userGold;
- int remainingGold;
- bool isAbleToPay;
- Console.Write("Введите количество золота: ");
- userGold = Convert.ToInt32(Console.ReadLine());
- Console.Write($"Стоимость одного кримстала - {priceOfCrystal} золота. Сколько кристалов хотите купить?: ");
- countOfCrystal = Convert.ToInt32(Console.ReadLine());
- isAbleToPay = userGold >= countOfCrystal * priceOfCrystal;
- countOfCrystal = (countOfCrystal * Convert.ToInt32(isAbleToPay));
- remainingGold = userGold - countOfCrystal * priceOfCrystal;
- Console.WriteLine($"Вы купили {countOfCrystal} кристалов. Ваш баланс - {remainingGold} золота.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement