anizko

10. Rage Expenses

May 19th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _10.Rage_Expenses
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.  
  15.             int lostGamesCount = int.Parse(Console.ReadLine());
  16.             double headsetPrice = double.Parse(Console.ReadLine());
  17.             double mousePrice = double.Parse(Console.ReadLine());
  18.             double keyboardPrice = double.Parse(Console.ReadLine());
  19.             double displayPrice = double.Parse(Console.ReadLine());
  20.  
  21.             int lostHeadsetCounter = 0;
  22.             int lostMouseCounter = 0;
  23.             double lostKeyboardCounter = 0;
  24.             double lostDisplayCounter = 0;
  25.  
  26.             for (int i = 1; i <= lostGamesCount; i++)
  27.             {
  28.                 if (i % 2 == 0)
  29.                 {
  30.                     lostHeadsetCounter++;
  31.                 }
  32.                 if (i % 3 == 0)
  33.                 {
  34.                     lostMouseCounter++;
  35.                 }
  36.                 if (i % 2 == 0 && i % 3 == 0)
  37.                 {
  38.                     lostKeyboardCounter++;
  39.                     lostDisplayCounter = Math.Floor(lostKeyboardCounter / 2);
  40.                 }
  41.  
  42.  
  43.             }
  44.  
  45.             double RageExpenses = headsetPrice * lostHeadsetCounter +
  46.                 mousePrice * lostMouseCounter +
  47.                 keyboardPrice * lostKeyboardCounter +
  48.                 displayPrice * lostDisplayCounter;
  49.  
  50.             Console.WriteLine($"Rage expenses: {RageExpenses:f2} lv.");
  51.  
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment