Advertisement
Guest User

salary

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