Advertisement
dragonbs

Orders

Feb 2nd, 2023
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. int orders = int.Parse(Console.ReadLine());
  2. double totalPrice = 0;
  3. for (int i = 0; i < orders; i++)
  4. {
  5.     double orderPrice = 0;
  6.     double capsulePrice = double.Parse(Console.ReadLine());
  7.     int days = int.Parse(Console.ReadLine());
  8.     int capsuleCnt = int.Parse(Console.ReadLine());
  9.     orderPrice = days * capsuleCnt * capsulePrice;
  10.     totalPrice += orderPrice;
  11.     Console.WriteLine($"The price for the coffee is: ${orderPrice:f2}");
  12. }
  13.  
  14. Console.WriteLine($"Total: ${totalPrice:f2}");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement