Advertisement
rukvir

HW 4_2

Dec 2nd, 2021
863
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 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 HomeWorck_4_2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int myGold = 0;
  14.             int myСrystal = 0;
  15.             int amountCrystals;
  16.             int GoldToCrystal = 2;
  17.  
  18.             Console.WriteLine("Сколько дед отставил золота вам в наследство?");
  19.             myGold = Convert.ToInt32(Console.ReadLine());
  20.             Console.WriteLine("Сколько вы хотите купить кристаллов за это золото?" + "\n" +
  21.                  "--- Обменный курс: 1 кристалл за 2 золота ---");
  22.  
  23.             amountCrystals = Convert.ToInt32(Console.ReadLine());
  24.             myСrystal = amountCrystals;
  25.             myGold -= amountCrystals * GoldToCrystal;
  26.             Console.WriteLine("Вы получили: " + myСrystal + " кристаллов" + "\n" +
  27.                 "У вас осталось: " + myGold + " золото");
  28.  
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement