Advertisement
Guest User

1.7

a guest
Aug 19th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 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 ConsoleApplication3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int gold;
  14.             int crystals;
  15.             int price = 50;
  16.             int residue;
  17.  
  18.             Console.Write("Введите начальное количество золота = ");
  19.             gold = Convert.ToInt32(Console.ReadLine());
  20.  
  21.             crystals = gold / price;
  22.  
  23.             Console.Write("Вы можете купить до " + crystals + " кристаллов. Сколько вы бы хотели приобрести? ");
  24.             crystals = Convert.ToInt32(Console.ReadLine());
  25.  
  26.             residue = gold - (crystals * price);
  27.  
  28.             Console.WriteLine("Количество купленных кристаллов: " + crystals);
  29.             Console.WriteLine("Количество оставшегося золота: " + residue);
  30.             Console.ReadKey();
  31.  
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement