Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- string line = string.Empty;
- while ((line = Console.ReadLine()) != "End")
- {
- string destination = line;
- double neededMoney = double.Parse(Console.ReadLine());
- double money = 0;
- string savings = string.Empty;
- while (true)
- {
- savings = Console.ReadLine();
- if (savings == "End")
- {
- return;
- }
- money += double.Parse(savings);
- if (money >= neededMoney)
- {
- Console.WriteLine($"Going to {destination}!");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement