Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ExamPractice
- {
- class Program
- {
- static void Main(string[] args)
- {
- int countDays = 1;
- int attitudeReached = 5364;
- int attitudeEverest = 8848;
- string command = Console.ReadLine();
- int metersClimbed = 0;
- while (true)
- {
- if (command == "END")
- {
- break;
- }
- else if (command == "Yes")
- {
- countDays++;
- }
- if (countDays > 5)
- {
- break;
- }
- metersClimbed = int.Parse(Console.ReadLine());
- attitudeReached += metersClimbed;
- if (attitudeReached >= attitudeEverest)
- {
- break;
- }
- command = Console.ReadLine();
- }
- if (attitudeReached >= attitudeEverest)
- {
- Console.WriteLine($"Goal reached for {countDays} days!");
- }
- else
- {
- Console.WriteLine("Failed!");
- Console.WriteLine($"{attitudeReached}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement