Advertisement
kolioi

Traveling C#

Jul 15th, 2018
1,655
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         while (true)
  8.         {
  9.             string destination = Console.ReadLine();
  10.             if (destination == "End")
  11.                 break;
  12.  
  13.             double expences = double.Parse(Console.ReadLine()), savings = 0;
  14.  
  15.             while (savings < expences)
  16.             {
  17.                 double money = double.Parse(Console.ReadLine());
  18.                 savings += money;
  19.             }
  20.  
  21.             Console.WriteLine($"Going to {destination}!");
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement