Advertisement
MARINA_GREBENAROVA

Travelling

Oct 22nd, 2021
1,130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Travelling
  4. {
  5.     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.  
  16.                 while (savedMoney < budget)
  17.                 {
  18.                     savedMoney += double.Parse(Console.ReadLine());
  19.                 }
  20.                 Console.WriteLine($"Going to {destination}!");
  21.  
  22.                 destination = Console.ReadLine();
  23.             }
  24.  
  25.         }
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement