Advertisement
maus234

Untitled

Aug 15th, 2021
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Leson01
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. int gold;
  15. int crystalPrice = 2;
  16. int crystalCount;
  17. bool enoughGold;
  18.  
  19. Console.WriteLine("Добро пожаловать на чорний рынок! Цена кристаллов по" + crystalPrice + "золота");
  20. Console.Write("Сколько у вас золота:");
  21. gold = Convert.ToInt32(Console.ReadLine());
  22. Console.Write("Сколько кристаллов вам нужно:");
  23. crystalCount = Convert.ToInt32(Console.ReadLine());
  24. enoughGold = gold >= crystalCount * crystalPrice;
  25. crystalCount *= Convert.ToInt32(enoughGold);
  26. gold -= crystalCount * crystalPrice;
  27. Console.WriteLine($"У вас осталось золота: {gold} и кристаллов: {crystalCount} ");
  28.  
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement