Advertisement
Lyubohd

Salary

Dec 1st, 2019
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ForLoop
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int tabs = int.Parse(Console.ReadLine());
  10.             int salary = int.Parse(Console.ReadLine());
  11.  
  12.             for (int i = 0; i < tabs; i++)
  13.             {
  14.                 string tabName = Console.ReadLine();
  15.                 switch (tabName)
  16.                 {
  17.                     case "Facebook":
  18.                         salary -= 150;
  19.                         break;
  20.                     case "Instagram":
  21.                         salary -= 100;
  22.                         break;
  23.                     case "Reddit":
  24.                         salary -= 50;
  25.                         break;
  26.                 }
  27.                 if (salary <= 0)
  28.                 {
  29.                     break;
  30.                 }
  31.             }
  32.  
  33.             if (salary <= 0)
  34.             {
  35.                 Console.WriteLine("You have lost your salary.");
  36.             }
  37.             else
  38.             {
  39.                 Console.WriteLine(salary);
  40.             }
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement