Advertisement
Tervel

05Travelling

Oct 20th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _05Travelling
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9.  
  10. double money = 0;
  11. string command;
  12. while ((command = Console.ReadLine()) != "End")
  13. {
  14. double savingMoney = 0;
  15. double moneyNeed = double.Parse(Console.ReadLine());
  16.  
  17. for (int i = 0; moneyNeed >= savingMoney; i++)
  18. {
  19. money = double.Parse(Console.ReadLine());
  20. savingMoney += money;
  21. if (savingMoney >= moneyNeed)
  22. {
  23. Console.WriteLine($"Going to {command}!");
  24. break;
  25. }
  26. }
  27. }
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement