Advertisement
Prohause

Travelling

Oct 21st, 2018
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 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 _06.Travelling
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string destination = Console.ReadLine();
  14. if (destination=="End") //има тест който подава директно "End"
  15. {
  16. return;
  17. }
  18. double budget = double.Parse(Console.ReadLine());
  19. double sum = 0;
  20.  
  21. while (true)
  22. {
  23. double money = double.Parse(Console.ReadLine());
  24. sum += money;
  25. if (sum >= budget)
  26. {
  27. Console.WriteLine($"Going to {destination}!");
  28. destination = Console.ReadLine();
  29. if (destination != "End")
  30. {
  31. budget = double.Parse(Console.ReadLine());
  32. }
  33. sum = 0;
  34. }
  35. if (destination == "End")
  36. {
  37. break;
  38. }
  39. }
  40.  
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement