knikolov98

Untitled

Oct 15th, 2019
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Traveling
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string destination = string.Empty;
  10.             string input = string.Empty;
  11.  
  12.             double minimalBudget = 0;
  13.             double saved = 0;
  14.  
  15.             for (; input != "End";)
  16.             {
  17.                 saved = 0;
  18.  
  19.                 input = Console.ReadLine();
  20.  
  21.                 if (input == "End")
  22.                 {
  23.                     break;
  24.                 }
  25.  
  26.                 minimalBudget = double.Parse(Console.ReadLine());
  27.  
  28.                 for (; saved < minimalBudget ;) //saving
  29.                 {
  30.                     saved += double.Parse(Console.ReadLine());
  31.                 }
  32.                     Console.WriteLine($"Going to {input}!");
  33.  
  34.             }
  35.         }
  36.     }
  37. }
Add Comment
Please, Sign In to add comment