o91leg

Untitled

Mar 5th, 2020
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace CSlight
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int money;
  14. int crystal;
  15. int crystalPrice = 5;
  16. bool countMoney;
  17.  
  18. Console.Write("Ведите количество золота: ");
  19. money = Convert.ToInt32(Console.ReadLine());
  20. Console.Write("Сколько кристаллов вы хотите купить ? Стоимость одного кристала равна 5 ");
  21. crystal = Convert.ToInt32(Console.ReadLine());
  22.  
  23. countMoney = money >= crystalPrice * crystal;
  24. crystal *= Convert.ToInt32(countMoney);
  25.  
  26. money -= crystalPrice * crystal;
  27.  
  28. Console.WriteLine("Денег осталось: " + money + " Вы купили: " + crystal + " Кристалов");
  29. }
  30. }
  31. }
Add Comment
Please, Sign In to add comment