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 ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int money;
- int costOfCrystal = 30;
- int canBuyCrystal;
- int crystal;
- Console.WriteLine($"Приветствуем вас в нашем магазине кристаллов. Вы можете купить 1 кристалл за {costOfCrystal} монет. Вы пересчитываете монеты своём кошельке. У вас:");
- money = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine($"У вас целых {money} монет.");
- canBuyCrystal = money / costOfCrystal;
- Console.WriteLine($"Вы можете купить {canBuyCrystal} кристаллов. Сколько хотите купить?");
- int wantBuyCrystal = Convert.ToInt32(Console.ReadLine());
- bool buy = canBuyCrystal >= wantBuyCrystal;
- crystal = Convert.ToInt32(buy) * wantBuyCrystal;
- money -=(Convert.ToInt32(buy) * wantBuyCrystal * costOfCrystal);
- string buyCrystal = $"У вас {crystal} кристаллов и {money} монет.";
- Console.WriteLine(buyCrystal);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement