Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Task1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int N = int.Parse(Console.ReadLine());
- var total = new List<decimal>();
- for (int i = 0; i < N; i++)
- {
- decimal pricePerCapsule = decimal.Parse(Console.ReadLine());
- string orderdate = Console.ReadLine();
- DateTime myDate = DateTime.ParseExact(orderdate, "d/M/yyyy", CultureInfo.InvariantCulture);
- int daysInMonth = System.DateTime.DaysInMonth(myDate.Year, myDate.Month);
- uint capsulesCount = uint.Parse(Console.ReadLine());
- decimal totalPerOrder = ((daysInMonth * capsulesCount) * pricePerCapsule);
- Console.WriteLine($"The price for the coffee is: ${totalPerOrder:f2}");
- total.Add(totalPerOrder);
- }
- decimal sum = total.Sum();
- Console.WriteLine($"Total: ${sum:f2}");
- }
- }
- }
- //((daysInMonth * capsulesCount) * pricePerCapsule)
Add Comment
Please, Sign In to add comment