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 Homework_1._2
- {
- class Program
- {
- static void Main(string[] args)
- {
- uint gold, crystalsCount;
- uint crystalCost = 100 ;
- bool enoughGold;
- Console.WriteLine("Вы приходите в магазин и хотите купить за своё золото кристаллы...");
- Console.Write("Введите начальное количество золота: ");
- gold = Convert.ToUInt32(Console.ReadLine());
- Console.WriteLine("Кристаллы продаются по цене " + crystalCost);
- Console.WriteLine("Сколько кристаллов нужно приобрести: ");
- crystalsCount = Convert.ToUInt32(Console.ReadLine());
- enoughGold = gold >= crystalCost * crystalsCount;
- crystalsCount *= Convert.ToUInt32(enoughGold);
- gold -= crystalsCount * crystalCost;
- Console.WriteLine("У вас в сумке: " + crystalsCount + " кристалла и " + gold + " золота.");
- }
- }
- }
Add Comment
Please, Sign In to add comment