Guest User

Untitled

a guest
May 31st, 2019
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 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.             double money = 0;//1 място
  15.  
  16.             while (true)
  17.             {
  18.                 destination = Console.ReadLine();
  19.                 if (destination == "End")
  20.                 {
  21.                     break;
  22.                 }
  23.                 double neededMoney = double .Parse(Console.ReadLine());//2, 3 място
  24.                 double savedMoney = 0;//4 място
  25.  
  26.                 while (savedMoney < neededMoney)
  27.                 {
  28.                     money = double .Parse(Console.ReadLine());//5 място
  29.                     savedMoney += money;
  30.                 }
  31.                 Console.WriteLine($"Going to {destination}!");
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment