mattnguyen

My Problem 1 (Mid Exam 10/07/2021)

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