Advertisement
rukvir

HW 1_6_2

Feb 2nd, 2025
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 KB | Software | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace HW_2025
  9. {
  10.     internal class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             float gold;
  15.             float crystal;
  16.             float convertIndexGold = 10;
  17.             float convertIndexCrytal = 3;
  18.  
  19.             Console.WriteLine("Hi! Сколько у вас ЗОЛОТА?");
  20.             gold = Convert.ToSingle(Console.ReadLine());
  21.  
  22.             Console.WriteLine("\nБу, купи голды!\n\n" +
  23.                 "К У Р С\n" +
  24.                 "########\n" +
  25.                 $"{convertIndexGold}g = {convertIndexCrytal}cr\n" +
  26.                 "Сколько желаешь купить кристалов?");
  27.             crystal = Convert.ToSingle(Console.ReadLine());
  28.             gold -= (convertIndexGold/convertIndexCrytal) * crystal;
  29.  
  30.             Console.WriteLine($"У вас на счете:\n" +
  31.                 $"Золота = {Math.Round(gold, 2)}\n" +
  32.                 $"Кристалов = {Math.Round(crystal, 2)}");
  33.  
  34.             Console.ReadKey();
  35.  
  36.         }
  37.     }
  38. }
  39.  
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement