nikolayneykov

Untitled

Oct 14th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2.  
  3. class Salary
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         int n = int.Parse(Console.ReadLine());
  8.         int salary = int.Parse(Console.ReadLine());
  9.  
  10.         for (int i = 0; salary > 0 && i < n; i++)
  11.         {
  12.             string website = Console.ReadLine();
  13.             salary -= website == "Facebook" ? 150 :
  14.                       website == "Instagram" ? 100 :
  15.                       website == "Reddit" ? 50 : 0;
  16.  
  17.         }
  18.         Console.WriteLine(salary > 0 ? salary.ToString() : "You have lost your salary.");
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment