Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 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. currentHeight = int.Parse(Console.ReadLine());
  23. if (command == "Yes")
  24. {
  25. countOfDays++;
  26. }
  27.  
  28. if (countOfDays <= 5)
  29.  
  30. {
  31. startedHeight += currentHeight;
  32. }
  33.  
  34.  
  35. }
  36. if (startedHeight >= peakHeight)
  37. {
  38. Console.WriteLine($"Goal reached for {countOfDays} days!");
  39. }
  40. else
  41. {
  42. Console.WriteLine("Failed!");
  43. Console.WriteLine(startedHeight);
  44. }
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement