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