Advertisement
spasnikolov131

Untitled

Jun 13th, 2023
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Everest
  4. {
  5. internal class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int baseCamp = 5364;
  10. const int top = 8848;
  11. int countDays = 1;
  12.  
  13. string text = Console.ReadLine();
  14.  
  15. while (text != "END" || baseCamp > top || countDays > 5)
  16. {
  17. if (text == "Yes")
  18. {
  19. int additional = int.Parse(Console.ReadLine());
  20. baseCamp += additional;
  21. countDays++;
  22.  
  23. }
  24. else if (text == "No")
  25. {
  26. baseCamp += int.Parse(Console.ReadLine());
  27.  
  28. countDays++;
  29. }
  30.  
  31.  
  32. text = Console.ReadLine();
  33.  
  34. }
  35. if (baseCamp > top)
  36. {
  37.  
  38. Console.WriteLine($"Goal reached for {countDays} days!");
  39.  
  40. }
  41. if (top > baseCamp)
  42. {
  43. Console.WriteLine("Failed!");
  44. Console.WriteLine($"{baseCamp}");
  45. }
  46.  
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement