Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int baseCamp = 5364;
- int mountEverest = 8848;
- int maxDays = 5;
- int current = baseCamp;
- int daysWithoutRelax = 0;
- int totalDays = 1;
- string input = Console.ReadLine();
- while (input != "END" && totalDays < maxDays)
- {
- if (input == "Yes")
- {
- totalDays++;
- }
- else if (input == "No")
- {
- daysWithoutRelax++;
- }
- int nextMeters = int.Parse(Console.ReadLine());
- current += nextMeters;
- if (current >= mountEverest)
- {
- break;
- }
- input = Console.ReadLine();
- }
- if (current >= mountEverest)
- {
- Console.WriteLine($"Goal reached for {totalDays} days!");
- }
- else
- {
- Console.WriteLine("Failed!");
- Console.WriteLine($"{current}");
- }
Advertisement
Add Comment
Please, Sign In to add comment