Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
66
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. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Travelling
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string destination = Console.ReadLine();
  14. int minBudget = int.Parse(Console.ReadLine());
  15.  
  16. int moreMoney = int.Parse(Console.ReadLine());
  17.  
  18. if (moreMoney >= minBudget)
  19. {
  20. Console.WriteLine($"Going to {destination}!");
  21. return;
  22. }
  23. else
  24. {
  25. while (destination != "End")
  26. {
  27. while (moreMoney <= minBudget)
  28. {
  29. moreMoney += int.Parse(Console.ReadLine());
  30.  
  31. }
  32. Console.WriteLine($"Going to {destination}!");
  33. destination = Console.ReadLine();
  34. minBudget = int.Parse(Console.ReadLine());
  35. moreMoney = int.Parse(Console.ReadLine());
  36.  
  37. if (moreMoney >= minBudget)
  38. {
  39. Console.WriteLine($"Going to {destination}!");
  40. return;
  41. }
  42. }
  43. }
  44.  
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement