Advertisement
bonumopus

taskcrystals

Apr 8th, 2020
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 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 shop
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int price = 5;
  14.             int playerMoney;
  15.             int crystals;
  16.  
  17.             Console.WriteLine("Вы зашли в магазин, чтобы купить немного кристаллов.");
  18.             Console.WriteLine("Сколько у вас с собой золотых монет?");
  19.             playerMoney = Convert.ToInt32(Console.ReadLine());
  20.  
  21.             Console.WriteLine($"Кристаллы стоят {price} монет за штуку. Сколько штук вы хотите купить?");
  22.             crystals = Convert.ToInt32(Console.ReadLine());
  23.  
  24.             playerMoney = playerMoney - crystals * price;
  25.  
  26.             Console.WriteLine($"Теперь у вас {crystals} кристаллов и {playerMoney} золотых монет.");
  27.             Console.ReadLine();
  28.         }
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement