Advertisement
aggressiveviking

Untitled

Feb 15th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _05.Travelling
  4. {
  5.     class Travelling
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string destination = string.Empty;
  10.             double money = 0;
  11.  
  12.             while (true)
  13.             {
  14.                 destination = Console.ReadLine();
  15.                
  16.                 if (destination == "End")
  17.                 {
  18.                     break;
  19.                 }
  20.                
  21.                 double neededMoney = double.Parse(Console.ReadLine());
  22.                 double savedMoney = 0;
  23.  
  24.                 while (savedMoney < neededMoney)
  25.                 {
  26.                     money = double.Parse(Console.ReadLine());
  27.                     savedMoney += money;
  28.                 }
  29.                
  30.                 Console.WriteLine($"Going to {destination}!");
  31.             }
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement