Advertisement
IvetValcheva

05. Salary

Jan 31st, 2022
264
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 Salary
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine()); //брой отворени табове
  10.             int salary = int.Parse(Console.ReadLine());
  11.  
  12.             int penalty = 0;
  13.  
  14.             for (int i = 1; i <=n; i++)
  15.             {
  16.                 string site = Console.ReadLine();
  17.  
  18.                 if(site== "Facebook")
  19.                 {
  20.                     penalty += 150;
  21.                 }
  22.                 else if (site == "Instagram")
  23.                 {
  24.                     penalty += 100;
  25.                 }
  26.                 else if (site == "Reddit")
  27.                 {
  28.                     penalty += 50;
  29.                 }
  30.  
  31.                 if (penalty >= salary)
  32.                 {
  33.                     Console.WriteLine("You have lost your salary.");
  34.                     break;
  35.                 }
  36.             }
  37.  
  38.             if (penalty < salary)
  39.             {
  40.                 Console.WriteLine(salary-penalty);
  41.             }
  42.         }
  43.     }
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement