holllowknight

ДЗ: Магазин

Mar 3rd, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text.RegularExpressions;
  5. // Compiler version 4.0, .NET Framework 4.5
  6.  
  7. namespace Dcoder
  8. {
  9.     public class Program
  10.     {
  11.         public static void Main(string[] args)
  12.         {
  13.             uint crystalPrice = 7;
  14.  
  15.             Console.Write("Введите начальное количество золота: ");
  16.             string userInput = Console.ReadLine();
  17.             uint goldAmount = UInt32.Parse(userInput);
  18.  
  19.             Console.WriteLine("Стоимость одного кристалла "+ crystalPrice + " золотых монет");
  20.             Console.Write("Сколько кристаллов Вы желаете приобрести? ");
  21.             userInput = Console.ReadLine();
  22.             uint crystalsToBuy = UInt32.Parse(userInput);
  23.  
  24.             goldAmount -= crystalsToBuy * crystalPrice;
  25.             Console.WriteLine("оставшееся золото: " + goldAmount);
  26.             Console.WriteLine("количество кристаллов: " + crystalsToBuy);
  27.         }
  28.     }
  29. }
Add Comment
Please, Sign In to add comment