Viktomirova

Salary

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