Advertisement
MladenKarachanov

C#

Oct 15th, 2023
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. namespace ConsoleApp2
  2. {
  3. class Program
  4. {
  5. static void Main(string[] args)
  6. {
  7. // Input and conversion USD -> BGN
  8. var processorUsd = double.Parse(Console.ReadLine());
  9. var processorBgn = processorUsd * 1.57;
  10. var videoUsd = double.Parse(Console.ReadLine());
  11. var videoBgn = videoUsd * 1.57;
  12. var ramUsd = double.Parse(Console.ReadLine());
  13. var ramBgn = ramUsd * 1.57;
  14. var ramQuantity = int.Parse(Console.ReadLine());
  15. var ramPrice = ramBgn * ramQuantity;
  16.  
  17. // Discount percentage
  18. var discount = double.Parse(Console.ReadLine());
  19.  
  20. // Total prices of parts
  21. var processorTotal = processorBgn - (processorBgn * discount);
  22. var videoTotal = videoBgn - (videoBgn * discount);
  23. var ramTotal = ramPrice;
  24.  
  25. // Total output price
  26. var totalPrice = processorTotal + videoTotal + ramTotal;
  27. Console.WriteLine($"Money needed - {totalPrice:F2} leva.");
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement