Guest User

Untitled

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