Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Plug_WALK
- {
- class Program
- {
- static void Main(string[] args)
- {
- int steps = 0;
- string input = String.Empty;
- int stepsLeft = 0;
- bool Enough = false;
- while (steps <= 10000)
- {
- input = Console.ReadLine();
- if (input == "Going home")
- {
- steps += int.Parse(Console.ReadLine());
- stepsLeft = 10000 - steps;
- if (steps >= 10000)
- {
- Enough = true;
- }
- break;
- }
- else
- {
- steps += int.Parse(input);
- if (steps >= 10000)
- {
- Enough = true;
- break;
- }
- }
- }
- if (Enough)
- {
- Console.WriteLine("Goal reached! Good job!");
- }
- else
- {
- Console.WriteLine($"{stepsLeft} more steps to reach goal.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement