Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Traveling
- {
- class Program
- {
- static void Main(string[] args)
- {
- string destination = Console.ReadLine();
- int neededMoney = int.Parse(Console.ReadLine());
- int sum = 0;
- while (destination != "End")
- {
- int input = int.Parse(Console.ReadLine());
- sum += input;
- if (sum >= neededMoney)
- {
- Console.WriteLine($"Going to {destination}!");
- sum = 0;
- destination = Console.ReadLine();
- if (destination == "End" || destination == "")
- {
- Environment.Exit(0);
- }
- neededMoney = int.Parse(Console.ReadLine());
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement