Advertisement
DeeAG

Problem1

Mar 3rd, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Problem1
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int ordersCount = int.Parse(Console.ReadLine());
  10.  
  11.             decimal total = 0;
  12.  
  13.             for (int i = 0; i < ordersCount; i++)
  14.             {
  15.                 decimal pricePerCapsule = decimal.Parse(Console.ReadLine());
  16.                 int days = int.Parse(Console.ReadLine());
  17.                 int capsulesCount = int.Parse(Console.ReadLine());
  18.  
  19.                 decimal priceForTheCoffee = days * capsulesCount * pricePerCapsule;
  20.                 total += priceForTheCoffee;
  21.  
  22.                 Console.WriteLine($"The price for the coffee is: ${priceForTheCoffee:f2}");
  23.             }
  24.  
  25.             Console.WriteLine($"Total: ${total:f2}");
  26.         }
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement