Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLight
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int costCrystal = 7;
- Console.WriteLine($"Цена одного кристалла равна {costCrystal}");
- Console.Write("Введите ваше кол-во золота: ");
- int amountGold = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите кол-во кристаллов, которое вы хотите купить: ");
- int amountCrystal = Convert.ToInt32(Console.ReadLine());
- int amountRequired = amountCrystal * costCrystal;
- if (amountRequired > amountGold)
- {
- int amountMissing = amountRequired - amountGold;
- Console.WriteLine($"Вы не можете купить данное кол-во кристаллов ({amountCrystal} шт.), вам не хватает {amountMissing} золота");
- }
- else
- {
- amountGold -= amountRequired;
- Console.WriteLine($"Вы купили кристаллы в количестве {amountCrystal} шт., у вас осталось {amountGold} золота");
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment