Icakman

Bachelor

Nov 24th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. using System;
  2.  
  3. namespace BachelorParty
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int gestArtist = int.Parse(Console.ReadLine());
  10. int totalSum = 0;
  11. int totalGests = 0;
  12. while(true)
  13. {
  14. string input = Console.ReadLine();
  15. if (input == "The restaurant is full")
  16. {
  17. break;
  18. }
  19. else
  20. {
  21. int group = int.Parse(input);
  22. if (group < 5)
  23. {
  24. totalSum += (group * 100);
  25.  
  26. }
  27. else
  28. {
  29. totalSum += (group*70);
  30. }
  31. totalGests += group;
  32. }
  33.  
  34. }
  35. int diff = totalSum - gestArtist;
  36. if (diff >= 0)
  37. {
  38. Console.WriteLine($"You have {totalGests} guests and {diff} leva left.");
  39. }
  40. else
  41. {
  42. Console.WriteLine($"You have {totalGests} guests and {totalSum} leva income, but no singer.");
  43. }
  44.  
  45. }
  46. }
  47. }
Add Comment
Please, Sign In to add comment