Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 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 _6._1Travel
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             string destination = Console.ReadLine();
  15.             int minBudget = int.Parse(Console.ReadLine());
  16.             int addMoney = 0;
  17.             int totalmoneySaved = 0;
  18.             string visitedPlaces = string.Empty;
  19.             int n = 0;
  20.  
  21.             while (destination!="End")
  22.             {
  23.                 visitedPlaces +="Going to "+destination+"!\n";
  24.                 while (minBudget>=totalmoneySaved)
  25.                 {
  26.                     addMoney = int.Parse(Console.ReadLine());
  27.                     totalmoneySaved += addMoney;
  28.                     if (totalmoneySaved >= minBudget)
  29.                     {
  30.                         break;
  31.                     }
  32.                 }
  33.  
  34.                 destination = Console.ReadLine();
  35.                 if(destination=="End")
  36.                 {  
  37.                     break;
  38.                 }
  39.                 n++;
  40.                 minBudget = int.Parse(Console.ReadLine());
  41.                 totalmoneySaved = 0;
  42.                
  43.             }
  44.  
  45.             Console.Write(visitedPlaces);
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement