Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 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 Everest
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int startedHeight = 5364;
  14. int peakHeight = 8848;
  15. int countOfDays = 1;
  16. int maxDays = 5;
  17. int currentHeight = 0;
  18. string command = string.Empty;
  19.  
  20. while (countOfDays <= 5 && startedHeight < peakHeight && (command = Console.ReadLine()) != "End")
  21. {
  22. if (command == "Yes")
  23. {
  24. countOfDays++;
  25. }
  26.  
  27. currentHeight = int.Parse(Console.ReadLine());
  28. if (countOfDays <= 5)
  29.  
  30. {
  31. startedHeight += currentHeight;
  32. }
  33. else
  34.  
  35.  
  36. {
  37. break;
  38. }
  39.  
  40. }
  41. if (startedHeight >= peakHeight)
  42. {
  43. Console.WriteLine($"Goal reached for {countOfDays} days!");
  44. }
  45. else
  46. {
  47. Console.WriteLine("Failed!");
  48. Console.WriteLine(startedHeight);
  49. }
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement