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