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 Walking
- {
- class Program
- {
- static void Main(string[] args)
- {
- int allSteps = 0;
- string command = string.Empty;
- while (true)
- {
- command = Console.ReadLine();
- if (command == "Going home")
- {
- int stepsToHome = int.Parse(Console.ReadLine());
- allSteps += stepsToHome;
- break;
- }
- int steps = int.Parse(command);
- allSteps += steps;
- if (allSteps >= 10000)
- {
- break;
- }
- }
- if (allSteps >= 10000)
- {
- Console.WriteLine("Goal reached! Good job!");
- }
- else
- {
- int diffSteps = 10000 - allSteps;
- Console.WriteLine($"{diffSteps} more steps to reach goal.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment