Advertisement
spasnikolov131

Untitled

Jan 25th, 2024
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Projects_Creation
  4. {
  5. internal class Program
  6. {
  7. static void Main(string[] args)
  8.  
  9. {
  10. int total = 0;
  11.  
  12.  
  13. while (true)
  14. {
  15. string destination = Console.ReadLine();
  16.  
  17. if (destination == "End")
  18. {
  19. break;
  20. }
  21. int minBudget = int.Parse(Console.ReadLine());
  22.  
  23. while (true)
  24. {
  25. string sum = Console.ReadLine();
  26.  
  27. if (sum == "End")
  28. {
  29. Console.WriteLine($"Going to {destination}!");
  30. break;
  31. }
  32.  
  33. total += int.Parse(sum);
  34.  
  35. if (total >= minBudget)
  36. {
  37. Console.WriteLine($"Going to {destination}!");
  38. break;
  39. }
  40. }
  41. total = 0;
  42. }
  43.  
  44. }
  45. }
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement