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 _6._1Travel
- {
- class Program
- {
- static void Main(string[] args)
- {
- string destination = Console.ReadLine();
- int minBudget = int.Parse(Console.ReadLine());
- int addMoney = 0;
- int totalmoneySaved = 0;
- string visitedPlaces = string.Empty;
- int n = 0;
- while (destination!="End")
- {
- visitedPlaces +="Going to "+destination+"!\n";
- while (minBudget>=totalmoneySaved)
- {
- addMoney = int.Parse(Console.ReadLine());
- totalmoneySaved += addMoney;
- if (totalmoneySaved >= minBudget)
- {
- break;
- }
- }
- destination = Console.ReadLine();
- if(destination=="End")
- {
- break;
- }
- n++;
- minBudget = int.Parse(Console.ReadLine());
- totalmoneySaved = 0;
- }
- Console.Write(visitedPlaces);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement