Advertisement
dragonbs

Rage Expenses

Feb 2nd, 2023
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. int lostGames = int.Parse(Console.ReadLine());
  2. double headsetPrice = double.Parse(Console.ReadLine());
  3. double mousePrice = double.Parse(Console.ReadLine());
  4. double keyboardPrice = double.Parse(Console.ReadLine());
  5. double displayPrice = double.Parse(Console.ReadLine());
  6.  
  7. int countBreakHeadset = 0;
  8. int countBreakMouse = 0;
  9. int countBreakKeyboard = 0;
  10. int countBreakDisplay = 0;
  11.  
  12. for (int i = 1; i <= lostGames; i++)
  13. {
  14.     if (i % 2 == 0)
  15.     {
  16.         countBreakHeadset++;
  17.     }
  18.  
  19.     if (i % 3 == 0)
  20.     {
  21.         countBreakMouse++;
  22.     }
  23.  
  24.     if (i % 6 == 0)
  25.     {
  26.         countBreakKeyboard++;
  27.     }
  28.  
  29.     if (i % 12 == 0)
  30.     {
  31.         countBreakDisplay++;
  32.     }
  33. }
  34.  
  35. double expenses = headsetPrice * countBreakHeadset + mousePrice * countBreakMouse + keyboardPrice * countBreakKeyboard + displayPrice * countBreakDisplay;
  36.  
  37. Console.WriteLine($"Rage expenses: {expenses:f2} lv.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement