Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int goldCount = 100;
- int crystalPrice = 10;
- int crystalCount;
- bool enoughMoney;
- Console.Write("Сколько кристаллов вы хотите купить?");
- crystalCount = Convert.ToInt32(Console.ReadLine());
- enoughMoney = goldCount >= crystalCount * crystalPrice;
- crystalCount *= Convert.ToInt32(enoughMoney);
- goldCount -= crystalCount * crystalPrice;
- Console.WriteLine($"После сделки у вас осталось {goldCount} золота и появилось {crystalCount} кристаллов.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement