Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.54 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _01.FirstExercise
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int lostGamesCount = 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.             int headsetTrashesh = 0;
  16.             int mouseTrashes = 0;
  17.             int displayTrashes = 0;
  18.             int keyboardTrashes = 0;
  19.  
  20.             for (int game = 1; game <= lostGamesCount; game++)
  21.             {
  22.                 bool keyboard = false;
  23.                 if (game % 2 == 0)
  24.                 {
  25.                     headsetTrashesh++;
  26.                 }
  27.                 if (game % 3 == 0)
  28.                 {
  29.                     mouseTrashes++;
  30.                 }
  31.                 if (game % 2 == 0 && game % 3 == 0)
  32.                 {
  33.                     keyboardTrashes++;
  34.                     keyboard = true;
  35.                 }
  36.                 if (keyboard && keyboardTrashes % 2 == 0 && keyboardTrashes != 0)
  37.                 {
  38.                     displayTrashes++;
  39.                 }
  40.             }
  41.  
  42.             double totalPrice = mouseTrashes * mousePrice + headsetTrashesh * headsetPrice + displayTrashes * displayPrice + keyboardTrashes * keyboardPrice;
  43.  
  44.             Console.WriteLine($"Rage expenses: {totalPrice:f2} lv.");
  45.        
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement