Advertisement
silvana1303

rage expenses

Jun 19th, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.41 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Diagnostics.CodeAnalysis;
  5. using System.Linq;
  6. using System.Threading;
  7.  
  8. namespace ConsoleApp1
  9. {
  10.     class Exam
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int loses = int.Parse(Console.ReadLine());
  15.             double headset = double.Parse(Console.ReadLine());
  16.             double mouse = double.Parse(Console.ReadLine());
  17.             double keyboard = double.Parse(Console.ReadLine());
  18.             double display = double.Parse(Console.ReadLine());
  19.  
  20.             int headsetTrash = 0;
  21.             int mouseTrash = 0;
  22.             int keyboardTrash = 0;
  23.             int displayTrash = 0;
  24.  
  25.             for (int i = 1; i <= loses; i++)
  26.             {
  27.                 if (i % 2 == 0)
  28.                 {
  29.                     headsetTrash++;
  30.                 }
  31.                 if (i % 3 == 0)
  32.                 {
  33.                     mouseTrash++;
  34.                 }
  35.                 if(i % 6 == 0)
  36.                 {
  37.                     keyboardTrash++;
  38.                 }
  39.                 if (i % 12 == 0)
  40.                 {
  41.                     displayTrash++;
  42.                 }
  43.             }
  44.  
  45.             double sum = (headset * headsetTrash) + mouse * mouseTrash + keyboard * keyboardTrash + display * displayTrash;
  46.  
  47.             Console.WriteLine($"Rage expenses: {sum:f2} lv.");
  48.  
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement