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 _05.Travelling
- {
- class Program
- {
- static void Main(string[] args)
- {
- while (true)
- {
- var destination = Console.ReadLine();
- int budjet = int.Parse(Console.ReadLine());
- int sum = 0;
- if (destination!="End") {
- while (true)
- {
- int money = int.Parse(Console.ReadLine());
- sum += money;
- if (sum>=budjet)
- {
- Console.WriteLine($"Going to {destination}!");
- sum =0;
- break;
- }
- }
- }
- else
- {
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement