Advertisement
alexbancheva

Rage Expenses_Fund_Arrays

May 18th, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Rage_Expenses_Fund_Exercise_1
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int countOfLostGames = int.Parse(Console.ReadLine());
  10.             double headsetPrice = double.Parse(Console.ReadLine());
  11.             double mousePrice = double.Parse(Console.ReadLine());
  12.             double keyboardPrice = double.Parse(Console.ReadLine());
  13.             double displayPrice = double.Parse(Console.ReadLine());
  14.  
  15.             double total = 0;
  16.  
  17.             int counterBreakHeadset = 0;
  18.             int counterBreakMouse = 0;
  19.             int counterBreakKeyboard = 0;
  20.             int counterBreakDisplay = 0;
  21.  
  22.             for (int i = 1; i <= countOfLostGames; i++)
  23.             {
  24.                 if (i % 2 == 0)
  25.                 {
  26.                     counterBreakHeadset++;
  27.                 }
  28.  
  29.                 if (i % 3 == 0)
  30.                 {
  31.                     counterBreakMouse++;
  32.                 }
  33.  
  34.                 if (i % 2 == 0 && i % 3 == 0)
  35.                 {
  36.                     counterBreakKeyboard++;
  37.                     if (counterBreakKeyboard % 2 == 0)
  38.                     {
  39.                         counterBreakDisplay++;
  40.                     }
  41.                 }
  42.             }
  43.  
  44.             total = counterBreakHeadset * headsetPrice + counterBreakMouse * mousePrice + counterBreakKeyboard * keyboardPrice + counterBreakDisplay * displayPrice;
  45.  
  46.             Console.WriteLine($"Rage expenses: {total:f2} lv.");
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement