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