Advertisement
dragonbs

Travelling

Oct 22nd, 2022
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _05.Travelling
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string destination = Console.ReadLine();
  10.  
  11.             while (destination != "End")
  12.             {
  13.                 double budget = double.Parse(Console.ReadLine());
  14.                 double savedMoney = 0;
  15.                 while (savedMoney < budget)
  16.                 {
  17.                     savedMoney += double.Parse(Console.ReadLine());
  18.                 }
  19.  
  20.                 Console.WriteLine($"Going to {destination}!");
  21.  
  22.                 destination = Console.ReadLine();
  23.             }
  24.         }
  25.     }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement