Advertisement
Guest User

Untitled

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