Advertisement
Vapio

task3

Mar 3rd, 2021 (edited)
759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         uint crystalsPrice = 300;
  8.  
  9.         uint goldAmount = 0;
  10.         uint crystalsAmount = 0;
  11.        
  12.         string crystalsPriceStr = String.Format("Price of crystal is : {0}\n", crystalsPrice);
  13.        
  14.         Console.WriteLine(crystalsPriceStr);
  15.        
  16.         Console.WriteLine("Please input amount of gold : ");
  17.         goldAmount = Convert.ToUInt32(Console.ReadLine());
  18.        
  19.         crystalsAmount = goldAmount / crystalsPrice;
  20.         goldAmount -= (crystalsAmount * crystalsPrice);
  21.        
  22.         string crystalsAmountString = String.Format("Amount of bought crystals : {0}", crystalsAmount);    
  23.         string goldAmountString = String.Format("Amount of gold : {0}", goldAmount);
  24.        
  25.         Console.WriteLine(crystalsAmountString);
  26.         Console.WriteLine(goldAmountString);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement