SaNik74

Basics of programming. Lesson #6. Crystals shop

Feb 14th, 2023
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. internal class Program
  2. {
  3.     static void Main(string[] args)
  4.     {
  5.         int gold;
  6.         int crystals;
  7.         int priceOfCrystal = 16;
  8.  
  9.         Console.Write("Введите количество золота, которое у вас есть: ");
  10.         gold = Convert.ToInt32(Console.ReadLine());
  11.  
  12.         Console.Write("Сколько кристалов вы хотите купить? ");
  13.         crystals = Convert.ToInt32(Console.ReadLine());
  14.  
  15.         gold -= crystals * priceOfCrystal;
  16.  
  17.         Console.WriteLine($"У вас осталось {gold} золота и {crystals} кристалов.");
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment