Advertisement
Guest User

Untitled

a guest
May 20th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _10._Rage_Expenses
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int lostGames = int.Parse(Console.ReadLine());
  10. decimal headsetPrice = decimal.Parse(Console.ReadLine());
  11. decimal mousePrice = decimal.Parse(Console.ReadLine());
  12. decimal keyboardPrice = decimal.Parse(Console.ReadLine());
  13. decimal displayPrice = decimal.Parse(Console.ReadLine());
  14.  
  15. int brokenHeadset = 0;
  16. int brokenMouse = 0;
  17. int brokenKeyboard = 0;
  18. int brokenDisplay = 0;
  19.  
  20. for (int i = 1; i <= lostGames; i++)
  21. {
  22. if (i % 6 == 0)
  23. {
  24. brokenHeadset++;
  25. brokenMouse++;
  26. brokenKeyboard++;
  27.  
  28. if (brokenKeyboard % 2 == 0)
  29. {
  30. brokenDisplay++;
  31. }
  32. }
  33. else if (i % 3 == 0)
  34. {
  35. brokenMouse++;
  36. }
  37. else if (i % 2 == 0)
  38. {
  39. brokenHeadset++;
  40. }
  41. }
  42.  
  43. decimal totalPrice =
  44. brokenHeadset * headsetPrice +
  45. brokenMouse * mousePrice +
  46. brokenKeyboard * keyboardPrice +
  47. brokenDisplay * displayPrice;
  48.  
  49. Console.WriteLine($"Rage expenses: {totalPrice:f2} lv.");
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement