IvetValcheva

06. Salary

Apr 26th, 2021
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. using System;
  2.  
  3. namespace OnTimeForTheExam
  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.             for (int i = 1; i <= n; i++)
  13.             {
  14.                 string website = Console.ReadLine();
  15.  
  16.                 if (website == "Facebook")
  17.                 {
  18.                     salary = salary - 150;
  19.                     //salary -=150;
  20.                 }
  21.                 else if (website == "Instagram")
  22.                 {
  23.                     salary = salary - 100;
  24.                     //salary -=100;
  25.                 }
  26.                 else if (website == "Reddit")
  27.                 {
  28.                     salary = salary - 50;
  29.                     //salary -=50;
  30.                 }
  31.  
  32.                 if (salary <= 0)
  33.                 {
  34.                     Console.WriteLine("You have lost your salary.");
  35.                     break;
  36.                 }
  37.             }
  38.  
  39.             if (salary > 0)
  40.             {
  41.                 Console.WriteLine(salary);
  42.             }
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment