12Vitaly

3

Apr 30th, 2020
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 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 CSLight
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int gold;
  14.             int crystal;
  15.             int crystalPrice = 10;
  16.             bool notEnoughGold;
  17.  
  18.             Console.Write("Введите ваше количество золота: ");
  19.             gold = Convert.ToInt32(Console.ReadLine());
  20.             Console.Write("Сегодняшняя цена кристаллов " + crystalPrice + " сколько вы хотите купить ");
  21.             crystal = Convert.ToInt32(Console.ReadLine());
  22.  
  23.             notEnoughGold = gold >= crystal * crystalPrice;
  24.             crystal *= Convert.ToInt32(notEnoughGold);
  25.             gold -= crystalPrice * crystal;
  26.  
  27.             Console.WriteLine("Ваше количество золота: " + gold + " и кристаллов: " + crystal);
  28.             Console.ReadKey();
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment