Advertisement
VickSuna

Untitled

Mar 11th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Podgotovka_za_izpit_201912_4._Bachelors_Party
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int singer = int.Parse(Console.ReadLine());
  10.  
  11. int guests = 0;
  12.  
  13. int moneyFor1Guest = 0;
  14.  
  15. int moneyAll = 0;
  16.  
  17. string command = Console.ReadLine();
  18.  
  19. while (command != "The restaurant is full")
  20. {
  21. int numGuests = int.Parse(command);
  22.  
  23. if (numGuests < 5)
  24. {
  25. moneyFor1Guest = 100;
  26. }
  27. else
  28. {
  29. moneyFor1Guest = 70;
  30. }
  31.  
  32. guests += numGuests;
  33.  
  34. moneyAll += numGuests * moneyFor1Guest;
  35.  
  36. command = Console.ReadLine();
  37.  
  38. }
  39.  
  40. if (command == "The restaurant is full")
  41. {
  42. if (moneyAll >= singer)
  43. {
  44. Console.WriteLine($"You have {guests} guests and {moneyAll - singer} leva left.");
  45. }
  46. else
  47. {
  48. Console.WriteLine($"You have {guests} guests and {moneyAll} leva income, but no singer.");
  49. }
  50.  
  51. }
  52.  
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement