Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int money;
- int crystalPrice = 10;
- int crystalCount;
- bool enoughMoney;
- Console.WriteLine("Добрый день! Сколько у вас денег? ");
- money = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Отлично! Сколько кристаллов Вы хотите приобрести?");
- crystalCount = Convert.ToInt32(Console.ReadLine());
- enoughMoney = money >= crystalCount * crystalPrice;
- crystalCount = Convert.ToInt32(enoughMoney);
- money -= crystalPrice * crystalCount;
- Console.WriteLine("Спасибо за покупку! Сейчас у Вас " + crystalCount + " кристаллов и " + money + " золота.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement