Advertisement
HisagiCT

Cbase5

Dec 11th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. static void Main(string[] args)
  2.         {
  3.             int gold;
  4.             int price;
  5.             int crystal;
  6.             bool enoughgold;
  7.  
  8.             Console.Write("Введите кол-во золота: ");
  9.             gold = Convert.ToInt32(Console.ReadLine());
  10.  
  11.             price = 10;
  12.  
  13.             Console.WriteLine("Цена кристаллов - " + price + " зол" + " за шт");
  14.             Console.Write("Введите кол-во кристаллов для покупки: ");
  15.             crystal = Convert.ToInt32(Console.ReadLine());
  16.  
  17.             enoughgold = gold >= price * crystal;
  18.             crystal *= Convert.ToInt32(enoughgold);
  19.             gold -= price * crystal;
  20.  
  21.             Console.WriteLine("У вас осталось золота - " + gold);
  22.             Console.WriteLine("Куплено кристаллов - " + crystal);
  23.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement