Advertisement
Guest User

06. Travelling

a guest
Jun 6th, 2019
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06._Travelling
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             int counter = 0;
  11.            
  12.             string destination = Console.ReadLine();
  13.             int minBudger = int.Parse(Console.ReadLine());
  14.  
  15.             while (destination != "End")
  16.             {
  17.                 int number = int.Parse(Console.ReadLine());
  18.                 counter += number;
  19.  
  20.                 if (counter >= minBudger)
  21.                 {
  22.                     Console.WriteLine($"Going to {destination}!");
  23.                     destination = Console.ReadLine();
  24.                     minBudger = int.Parse(Console.ReadLine());
  25.                     counter = 0;
  26.                 }
  27.  
  28.             }
  29.  
  30.         }
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement