Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Conosleapp1
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string destination = Console.ReadLine();
  10. int budget = int.Parse(Console.ReadLine());
  11. int money = 0;
  12.  
  13. while (budget > money)
  14. {
  15. string command = Console.ReadLine();
  16. if (command != "End")
  17. {
  18.  
  19. money = money + int.Parse(command);
  20. if (money >= budget)
  21. {
  22. Console.WriteLine($"Going to {destination}");
  23. destination = Console.ReadLine();
  24. budget = int.Parse(Console.ReadLine());
  25. money = 0;
  26. }
  27. }
  28. else if (command == "End")
  29. {
  30. return;
  31. }
  32. }
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement