Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Leson01
- {
- class Program
- {
- static void Main(string[] args)
- {
- int gold;
- int crystalPrice = 2;
- int crystalCount;
- bool enoughGold;
- Console.WriteLine("Добро пожаловать на чорний рынок! Цена кристаллов по" + crystalPrice + "золота");
- Console.Write("Сколько у вас золота:");
- gold = Convert.ToInt32(Console.ReadLine());
- Console.Write("Сколько кристаллов вам нужно:");
- crystalCount = Convert.ToInt32(Console.ReadLine());
- enoughGold = gold >= crystalCount * crystalPrice;
- crystalCount *= Convert.ToInt32(enoughGold);
- gold -= crystalCount * crystalPrice;
- Console.WriteLine($"У вас осталось золота: {gold} и кристаллов: {crystalCount} ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement