Advertisement
didito33

NestedCycleTrip

May 15th, 2021
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. using System;
  2.  
  3. namespace HelloSoftUni
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.            
  10.             for (int i = 0; ; i++)
  11.             {
  12.                 Console.WriteLine("enter the country:");
  13.                 string country = Console.ReadLine();
  14.                 if (country == "End")
  15.                     break;
  16.                 Console.WriteLine("enter the price of the journey: ");
  17.                 int price = int.Parse(Console.ReadLine());
  18.                 int totalSavedMoney = 0;
  19.                 for (int j = 0; ; j++)
  20.                 {
  21.                     int savedMoney = int.Parse(Console.ReadLine());
  22.                    
  23.                     totalSavedMoney += savedMoney;
  24.                     Console.WriteLine($"savedmoney {totalSavedMoney}");
  25.                    
  26.                     if (totalSavedMoney >= price)
  27.                     {
  28.                         Console.WriteLine($"Going to {country}!");
  29.                         break;
  30.                     }
  31.                 }
  32.                
  33.             }
  34.         }
  35.  
  36.     }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement