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