Advertisement
HRusev

Rage Expenses

May 16th, 2024
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 KB | Source Code | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Globalization;
  7.  
  8. namespace _10.RageExpenses
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int lostGames = Int32.Parse(Console.ReadLine());
  15.             decimal priceHeadset = decimal.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
  16.             decimal priceMouse = decimal.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
  17.             decimal priceKeyboard = decimal.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
  18.             decimal priceDisplay = decimal.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
  19.  
  20.             int trashedHeadset = 0;
  21.             int trashedMouse = 0;
  22.             int trashedKeyboard = 0;
  23.             int trashedDisplay = 0;
  24.             for (int i = 1; i <= lostGames; i++)
  25.             {
  26.                 if (i % 2 == 0)
  27.                     trashedHeadset++;
  28.                 if (i % 3 == 0)
  29.                     trashedMouse++;
  30.                 if(i % 2 == 0 & i % 3 == 0)
  31.                 {
  32.                     trashedKeyboard++;
  33.                     if (trashedKeyboard % 2 == 0)
  34.                         trashedDisplay++;
  35.                 }
  36.             }
  37.  
  38.             decimal sum = priceHeadset * trashedHeadset + priceMouse * trashedMouse + priceKeyboard * trashedKeyboard + priceDisplay * trashedDisplay;
  39.  
  40.             Console.WriteLine($"Rage expenses: {sum, 0:N2} lv.");
  41.            
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement