Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp5
- {
- class Program
- {
- static void Main(string[] args)
- {
- int userGoldCount, userDimondCount;
- int diamondPrice = 10;
- Console.Write("Сколько у вас золота?: ");
- userGoldCount = Convert.ToInt32(Console.ReadLine());
- Console.Write($"1 кристалл стоит {diamondPrice} золота\n" +
- "Сколько кристаллов вы хотите купить?: ");
- userDimondCount = Convert.ToInt32(Console.ReadLine());
- int diamondPriceCount = userDimondCount * diamondPrice;
- if (userGoldCount >= diamondPriceCount)
- {
- userGoldCount -= diamondPriceCount;
- Console.WriteLine("Успешно!");
- }
- else
- {
- userDimondCount = 0;
- Console.WriteLine("Недостаточно золота");
- }
- Console.WriteLine($"Кол-во Золота: {userGoldCount}\n" +
- $"Кол-во Кристаллов: {userDimondCount}");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement