Advertisement
HRusev

Orders

May 16th, 2024
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | Source Code | 0 0
  1. using System.Globalization;
  2.  
  3. namespace _11.Order
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int order = Int32.Parse(Console.ReadLine());
  10.  
  11.             double priceCapsule;
  12.             int days;
  13.             int count;
  14.  
  15.             double sum;
  16.             double total = 0;
  17.             string result;
  18.  
  19.             for (int i = 0; i < order; i++)
  20.             {
  21.                 priceCapsule = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
  22.                 days = Int32.Parse(Console.ReadLine());
  23.                 count = Int32.Parse(Console.ReadLine());
  24.  
  25.                 sum = ((days * count) * priceCapsule);
  26.                 total += sum;
  27.  
  28.                 result = sum.ToString("C", new CultureInfo("en-US"));
  29.                 Console.WriteLine($"The price for the coffee is: ${sum, 0:N2}");
  30.             }
  31.  
  32.  
  33.             result = total.ToString("C", new CultureInfo("en-US"));
  34.             Console.WriteLine($"Total: ${total, 0:N2}");
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement