Advertisement
aggressiveviking

Untitled

Mar 19th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.45 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _10.RageExpenses
  4. {
  5.     class RageExpenses
  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.             decimal sumHeadset = 0;
  16.             decimal sumMouse = 0;
  17.             decimal sumKeyboard = 0;
  18.             decimal sumDisplay = 0;
  19.             decimal temp = 0;
  20.  
  21.             for (int i = 1; i <= lostGames; i++)
  22.             {
  23.                 if (i % 2 == 0 && i % 3 == 0)
  24.                 {
  25.                     temp++;
  26.                     if (temp % 2 == 0)
  27.                     {
  28.                         sumDisplay += displayPrice;
  29.                     }
  30.                     sumKeyboard += keyboardPrice;
  31.  
  32.  
  33.                 }
  34.  
  35.                 if (i % 3 == 0)
  36.                 {
  37.                     sumMouse += mousePrice;
  38.                 }
  39.  
  40.                 if (i % 2 == 0)
  41.                 {
  42.                     sumHeadset += headsetPrice;
  43.                 }
  44.             }
  45.            
  46.             decimal sumAll = sumHeadset + sumMouse + sumKeyboard + sumDisplay;
  47.            
  48.             Console.WriteLine($"Rage expenses: {sumAll:f2} lv.");
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement