kwest87

Untitled

Dec 23rd, 2023
1,253
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.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace ConsoleApp6
  9. {
  10.     internal class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int goldCharacter;
  15.             int crystalCharacter;
  16.             int costCrystal = 5;
  17.             int userInput;
  18.  
  19.             Console.Write("Сколько у вас золота : ");
  20.             goldCharacter = Convert.ToInt32(Console.ReadLine());
  21.             Console.WriteLine();
  22.             Console.Write("Сколько кристаллов вы хотите приобрести : ");
  23.             userInput = Convert.ToInt32(Console.ReadLine());
  24.             Console.WriteLine();
  25.  
  26.             crystalCharacter = userInput;
  27.             goldCharacter -= userInput * costCrystal;
  28.  
  29.             Console.WriteLine($"Куплено {crystalCharacter} кристаллов , осталось {goldCharacter} золота.");
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment