Advertisement
Dimo1985

Untitled

Nov 17th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Travelling
  4. {
  5.     class Travel
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             for (int i = 0; i < int.MaxValue; i++)
  11.             {
  12.                 string destination = Console.ReadLine();
  13.                 if (destination == "End")
  14.                 {
  15.                     break;
  16.                 }
  17.                 double moneyNeeded = double.Parse(Console.ReadLine());
  18.                 double sum = 0;
  19.  
  20.                 while (sum < moneyNeeded)
  21.                 {
  22.                     double moneySaved = double.Parse(Console.ReadLine());
  23.                     sum += moneySaved;
  24.                 }
  25.                 Console.WriteLine($"Going to {destination}!");
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement