Advertisement
rukvir

HW 4_3

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