Advertisement
MARINA_GREBENAROVA

Salary

Oct 8th, 2021
877
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Salary
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             const int FACEBOOK = 150;
  10.             const int INSTAGRAM = 100;
  11.             const int REDDIT = 50;
  12.  
  13.             int openTabs = int.Parse(Console.ReadLine());
  14.             int salary = int.Parse(Console.ReadLine());
  15.  
  16.             for (int iterator = 1; iterator <= openTabs; iterator++)
  17.             {
  18.                 string sites = Console.ReadLine();
  19.                 if (sites == "Facebook")
  20.                 {
  21.                     salary -= FACEBOOK;
  22.                 }
  23.                 else if (sites == "Instagram")
  24.                 {
  25.                     salary -= INSTAGRAM;
  26.                 }
  27.                 else if (sites == "Reddit")
  28.                 {
  29.                     salary -= REDDIT;
  30.                 }
  31.  
  32.                 if (salary <= 0)
  33.                 {
  34.                     Console.WriteLine("You have lost your salary.");
  35.                     break;
  36.                 }
  37.             }
  38.             if (salary > 0)
  39.             {
  40.                 Console.WriteLine($"{salary}");
  41.             }
  42.  
  43.  
  44.         }
  45.     }
  46. }
  47.  
  48.  
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement