Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Everest
- {
- class Program
- {
- static void Main(string[] args)
- {
- int startedHeight = 5364;
- int peakHeight = 8848;
- int countOfDays = 1;
- int maxDays = 5;
- int currentHeight = 0;
- string command = string.Empty;
- while (countOfDays <= 5 && startedHeight < peakHeight && (command = Console.ReadLine()) != "End")
- {
- if (command == "Yes")
- {
- countOfDays++;
- }
- currentHeight = int.Parse(Console.ReadLine());
- if (countOfDays <= 5)
- {
- startedHeight += currentHeight;
- }
- else
- {
- break;
- }
- }
- if (startedHeight >= peakHeight)
- {
- Console.WriteLine($"Goal reached for {countOfDays} days!");
- }
- else
- {
- Console.WriteLine("Failed!");
- Console.WriteLine(startedHeight);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement