Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Dynamic;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Text;
- using System.Threading.Tasks;
- namespace CSLight
- {
- class Program
- {
- static void Main(string[] args)
- {
- int gold;
- int crystalPrice = 3;
- 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($"У вас {crystalCount} кристаллов и {gold} монет.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment