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