Advertisement
alexbancheva

Salary_Exercise_For_Loop

Nov 16th, 2019
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Salary_Exercise_For_Loop
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int tabs = int.Parse(Console.ReadLine());
  10. int salary = int.Parse(Console.ReadLine());
  11. string website = String.Empty;
  12.  
  13. for (int currentTab = 1; currentTab <= tabs; currentTab++)
  14. {
  15. website = Console.ReadLine();
  16.  
  17. if (website == "Facebook")
  18. {
  19. salary -= 150;
  20. }
  21. else if (website == "Instagram")
  22. {
  23. salary -= 100;
  24. }
  25. else if (website == "Reddit")
  26. {
  27. salary -= 50;
  28. }
  29.  
  30. if (salary <= 0)
  31. {
  32. Console.WriteLine("You have lost your salary.");
  33. return;
  34. }
  35. }
  36.  
  37. Console.WriteLine(salary);
  38.  
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement