Advertisement
NikaBang

Магазин кристаллов

May 12th, 2024
527
0
18 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2.  
  3. internal class Program
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         int priceCrystal = 5;
  8.         int crystals = 0;
  9.         int countCrystals;
  10.         int golds;
  11.  
  12.         Console.Write("Сколько у вас золота? - ");
  13.         golds = Convert.ToInt32(Console.ReadLine());
  14.  
  15.         Console.Write($"Цена кристала - {priceCrystal}. Сколько желаете купить? - ");
  16.         countCrystals = Convert.ToInt32(Console.ReadLine());
  17.  
  18.         crystals += countCrystals;
  19.         golds -= countCrystals * priceCrystal;
  20.  
  21.         Console.WriteLine($"У вас {golds} золота и {crystals} кристалов.");
  22.         Console.ReadKey();
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement