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 HW_les1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int money;
- int price = 10;
- int count;
- bool enoughMoney;
- Console.Write("Сколько у вас золота? ");
- money = Convert.ToInt32(Console.ReadLine());
- Console.Write($"Сегодня у нас кристаллы по {price} золота за штуку. Сколько вы хотите купить? ");
- count = Convert.ToInt32(Console.ReadLine());
- enoughMoney = money >= count * price;
- count *= Convert.ToInt32(enoughMoney);
- money -= count * price;
- Console.WriteLine($"Вы купили {count} кристаллов за {count * price} золота. У вас осталось {money} золота");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement