Last active
May 16, 2023 15:44
-
-
Save Strelok78/168e5a3bff660eb9ce238ee081729d23 to your computer and use it in GitHub Desktop.
At the start of the program, the user enters the initial amount of gold. Then he is offered to buy a certain number of crystals at the price of N. The user enter a number and his gold is converted into crystals. The rest of the gold and crystals are displayed on the screen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MyCode | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int gold; | |
int crystals; | |
int crystalPrice = 5; | |
Console.WriteLine("Enter your amount of gold"); | |
gold = int.Parse(Console.ReadLine()); | |
Console.WriteLine($"Price for each crystal is {crystalPrice}. How much do You want to buy?"); | |
crystals = int.Parse(Console.ReadLine()); | |
gold -= crystalPrice * crystals; | |
Console.WriteLine($"Curreently you have {gold} of gold and {crystals} of crystals"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment